[erlang-questions] Why EEP-0018 "JSON bifs" (and conforming libraries) are "wrong" about object encoding (i.e. `[{}]`)

alisdair sullivan alisdairsullivan@REDACTED
Thu Aug 28 08:11:43 CEST 2014


On Aug 26, 2014, at 2:30 PM, Ciprian Dorin Craciun <ciprian.craciun@REDACTED> wrote:
> 
>   The reason that I wrote this email is because I have invested
> quite some time in writing a "few" JSON utility functions (including
> complex schema validation, destructuring, etc.) which heavily use and
> extend the "mochi" variant.  Based on this experience and a small
> analysis I've done today, I concluded that EEP-0018 would be quite
> cumbersome for expressing any kind of extension without a lot of
> pattern-matching to catch the extensions.  However by no mean do I
> expect developers to change their libraries to suite such a usage, I
> only wanted to provide a counter-argument to EEP-0018.  Moreover, now
> that Erlang has hash objects, hopefully these can be used to express
> objects, and this problem would go away.
> 
>   Hopefully I haven't offended anyone, (I apologize in advance,)
>   Ciprian.
> 

if i were to write jsx today i’d still allow serialization of `[{}]` to the empty object “{}” but i’d also probably allow `{[]}` also. i’d never deserialize json to a proplist though; maps only. i’ve been working on a small experimental attempt at a ‘modern’ json api here:https://github.com/talentdeficit/json

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140827/ff76ba1a/attachment.htm>


More information about the erlang-questions mailing list