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

Loïc Hoguin <>
Tue Aug 30 01:53:23 CEST 2011


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.

-- 
Loïc Hoguin
Dev:Extend



More information about the erlang-questions mailing list