Search code examples
erlangerlang-shellerlangweb

how to use erlang function term_to_json?


I don't know how to use erlang function term_to_json and json_to_term, do I need to install some plugins or the moudule of those functions are not "erlang"?


Solution

  • There is currently no such function in Erlang. There is Erlang Enhancement Proposal, which describes this:

    http://www.erlang.org/eeps/eep-0018.html

    but it is not yet part of the language. Fortunately, there is quite a few libraries, that solve the problem. I can recommend:

    https://github.com/talentdeficit/jsx

    It is actively maintained, battle tested and used internally in bigger projects like Chicago Boss.