[erlang-questions] No JSON/MAPS interoperability in 17.0?
Pieter Hintjens
ph@REDACTED
Fri Mar 14 13:09:48 CET 2014
On Fri, Mar 14, 2014 at 12:55 PM, Joe Armstrong <erlang@REDACTED> wrote:
> To an implementor of a library JSON is complicated.
> When I think of *implementing* JSON<->Erlang maps My hair goes even greyer.
Absolutely. I've looked at using JSON several times in my protocols,
and each time it's... ugh... the only place I'm doing this now is for
detailed resource specifications, in that XRAP RESTful protocol.
There, a self-describing structure makes sense. XML, JSON, YAML, etc.
all good.
What is simple to implement, and useful for 90% of the cheap/nasty
contracts I've seen, are binary serialization for lists and hashes.
It's simple to do, efficient, and a map gives excellent space for
experimentation. Like HTTP headers, for example.
I'd probably go as far as saying, JSON encoding/decoding is an
application issue and should never be an infrastructure decision. Like
XML, YAML, or any other document format. Applications can be slow and
stupid, that is how they make profit. Infrastructure cannot.
Which brings us to a three-piece dance for protocols / contracts:
* tight binary encoding for rarely-changing fields
* an extensible map or maps for experimentation
* when needed, a content (type and blob) that contains document data
Where the infrastructure delivers the last part but never opens it.
-Pieter
More information about the erlang-questions
mailing list