[erlang-questions] [ANN] Erlson - dynamic name-value dictionary data type and syntax

Bob Ippolito bob@REDACTED
Tue Aug 30 02:12:35 CEST 2011


On Mon, Aug 29, 2011 at 4:53 PM, Loïc Hoguin <essen@REDACTED> wrote:
> On 08/30/2011 01:36 AM, Jack Moffitt wrote:
>>> May I suggest switching the decoded JSON format to that used by ejson
>>> (https://github.com/benoitc/ejson) and jiffy
>>> (https://github.com/davisp/jiffy) instead of the format used by
>>> mochiweb/mochijson2. Most of the projects that make heavy use of JSON seem
>>> to be moving to the format I'm suggesting.
>>
>> A tuple of an array of tuples seems less than elegant  Why not just a
>> tuple of tuples? Is scanning through a tuple significantly slower than
>> scanning an array?
>
> This should explain the whys:
>
> http://www.erlang.org/eeps/eep-0018.html
>
>> As far as formats go, this is a new one to me. Most projects I
>> interact with seem to use either mochijson or mochijson2. I'd love for
>> there to be a canonical one though.
>
> All recent JSON projects follow that EEP as far as I know. If OTP gets
> JSON support then your code will be working with the OTP implementation.
> It's also less annoying to write than {struct, ...} because it's trying
> (and not failing on me yet) to be a 1:1 match with Erlang types or when
> not possible to give expected results.
>
> Personally I prefer jsx (https://github.com/talentdeficit/jsx) simply
> because it's not a NIF and thus doesn't impact the scheduler. But your
> needs and requirements may vary.

It would be basically trivial to add {proplist()} support to
mochijson2 as an addition to {struct, proplist()}. There's not much of
a difference really, it's still wrapping a tuple around it but just
without a tag. I'll have a look at that.

-bob



More information about the erlang-questions mailing list