[erlang-questions] No JSON/MAPS interoperability in 17.0?

Carsten Bormann <>
Fri Mar 14 08:41:00 CET 2014


On 14 Mar 2014, at 02:08, Loïc Hoguin <> wrote:

> On 03/13/2014 09:16 PM, Carsten Bormann wrote:
>> On 10 Mar 2014, at 15:54, Loïc Hoguin <> wrote:
>> 
>>> Could you elaborate on what the dominant usage of JSON is?
>> 
>> Certainly.
>> 
>> JSON is used for data interchange between applications or within components of an application.
> 
> It's a terrible format for doing the above.
> 
> *  It's text-based, meaning it's incredibly slow to parse.

The encoding/parsing overhead is in the noise for many JSON applications.

But yes, other applications exist (hint: RFC 7049).

> *  It has to be valid UTF-8, meaning it's incredibly slow to validate.

Well… either the application needs text, in which case UTF-8 is the right way to encode it, or it doesn’t, in which case the point is moot.

> *  Its numbers representation is double-precision floating-point, meaning it's incredibly imprecise and limited.

JSON provides unlimited precision decimal floating point; it’s up to you what you do with that.
(Yes, most JSON implementations translate non-integers into IEEE 754 binary64; JavaScript even makes a point that that’s the only numeric format in that language even for integers.  The use of binary64 in libraries is just a reflection of the way floating-point is used in much of the industry.)

> These are the three main reasons why I avoid JSON. There are numerous others I'm sure. I'm sure everyone has heard horror stories.

While there may be horror stories around JSON*), overall the interoperability record of JSON is stellar.
The main reason programmers use JSON is that it is a one-liner solution to a problem that could require a lot of effort otherwise.

> Side note: I do not understand how so many programmers can identify themselves as pro-environment and then waste so much energy and resources by parsing these ridiculously bad formats and protocols. Stop using JSON, save the planet!

(In the Internet of Things, where we have to care much more about energy, this is a valid concern.
Did I mention RFC 7049?)

I like your comments about RESTfulness; this is indeed a major issue usually solved in rather ad-hoc ways.
This area needs work (RFC 7049 on its own doesn't help much, either; at least it offers tag 32).

                          oOo

None of this takes away from my point that, in 2014, to interoperate you need to speak JSON.

Grüße, Carsten

*) An amusing one for this community: https://dev.twitter.com/docs/twitter-ids-json-and-snowflake
Yes, an integer range issue :-)




More information about the erlang-questions mailing list