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

Pieter Hintjens ph@REDACTED
Fri Mar 14 09:38:54 CET 2014


When you judge an encoding like JSON you're weighing simplicity of use
against efficiency. For messages you send a few times a second, at
most, text encoding costs are irrelevant. The big advantage of JSON,
like XML and YAML, is the ability to extend contracts experimentally
and cheaply. In comparison, any binary format raises steep costs for
change, creating absurd incompatibility that has no benefit. The
OpenStack RPC API being a good example of this.

One answer I've used with success is the "Cheap and Nasty" pattern,
where slow-changing high-volume data uses a binary encoding, and
fast-changing low-volume data uses JSON, XML, or similar. By forcing
protocols into these extremes you can win both games. Using a single
approach for the two cases creates mediocrity, in my experience. Thus
mspack, protobufs, etc. are poor choices either way.

What this comes to is, often, a protocol message split into binary
fields that are extremely tuned and fast to parse, plus optionally, an
extensible hash or JSON document or similar.

We've built a toolkit for this, zeromq/zproto, which is simple and efficient.

Loic is right that lack of URLs in JSON makes it harder to use for
RESTful work, however that's trivially solved by defining URLs
explicitly. Then you can do very nice RESTful work without caring what
encoding you use.

E.g. https://github.com/UnifyProject/RFC/blob/master/draft/rfc-2.md

tl;dr use the best tool for the job, no single encoding can solve all use cases.

-Pieter


On Fri, Mar 14, 2014 at 8:56 AM, Benoit Chesneau <bchesneau@REDACTED> wrote:
> So I am curious in what could replace json today as an interoperable
> exchange data format. Message pack is interesting but not sure it's a
> good one (no type support). Any idea?
>
> - benoit
>
> On Fri, Mar 14, 2014 at 12:57 AM, Anthony Ramine <n.oxyde@REDACTED> wrote:
>> Where is the scientific study that proves this?
>>
>> Or is that just your personal experience?
>>
>> --
>> Anthony Ramine
>>
>> Le 13 mars 2014 à 21:16, Carsten Bormann <cabo@REDACTED> a écrit :
>>
>>> On 10 Mar 2014, at 15:54, Loïc Hoguin <essen@REDACTED> 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.
>>>
>>> The most extensive use is from JavaScript-based Web application front-ends (running in the browser) to their backends (running on a server) and back; these are shipped as application/json representations in AJAX accesses (HTTP access from JavaScript via the confusingly named XMLHttpRequest object).
>>>
>>> Many Web APIs that have been designed in the last half decade are described in JSON form, so applications that access another application via a Web API are likely to ship back and forth application/json representations via HTTP accesses.
>>>
>>> Grüße, Carsten
>>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list