Skip to content

Comment on No JSON/MAPS interoperability in 17.0?

Comments

JSON and Erlang just don't get along in the way you'd like them to, unfortunately. Some of that has to do with how Erlang handles (or doesn't handle) strings. Some of that was that there was not a data structure that closely mirrored JSON's structure in Erlang up until Maps were introduced.

The problem isn't really JSON - JSON is an exceptional format for what it is supposed to do - the problem is that Erlang was created for a specific purpose and that purpose wasn't to vend out strings/JSON over HTTP.

Erlang handles (or doesn't handle) strings.

JSON string are translated to binaries. There is no reason to keep repeating oh inters=strings. Maps will help.

The problem isn't really JSON

I think the author disagrees. He talks about the problems of "JSON". There are a few he notes:

* No binaries.

* No way to have hyperlinks

* Limited floating point number implementations

You have to translate your strings to binaries before you try to encode to JSON. A JSON encoder has no way of determining whether it should be encoding an array or a string without this. Instead of one string type, you have "strings" and <<"strings">>, and due to the lack of typing, it is actually pretty tough to keep track of which one you have. It also is an exercise in finger acrobatics to <<>> all your strings.

JSON doesn't solve every problem. It does solve the problem, quite elegantly, of creating a 'endianless' interchange format that is easily consumed, constructed, and debugged.

That reasons exists since a decade with emails. And did we change the system ? No, because it is simple and it work.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.