[erlang-questions] JSON encoding of arrays of arrays

Bob Ippolito bob@REDACTED
Fri Oct 22 11:29:07 CEST 2010

On Fri, Oct 22, 2010 at 4:54 PM, Alessandro Sivieri
<alessandro.sivieri@REDACTED> wrote:
> 2010/10/22 Bob Ippolito <bob@REDACTED>
>> I'm surprised that people are finding it to be complicated. A list of
>> lists is literally an erlang list with erlang lists in it. It looks
>> like the documentation does need some improvement though, it's only
>> really obvious if you use it or if you read through the data types.
> Well, maybe the documentation of mochijson2 is not *that* good (no offense
> here), I mean a couple of examples should be added I think. Also, the best
> API would be the one that takes the standard Erlang types (for example a
> list of lists) and produces a json, without the "struct" thing; I think
> there was a project like that somewhere on the Net, but it did not work with
> tuples...

I definitely didn't say that the documentation was very good, just
that the library is generally not that complicated.

The problem with your suggestion is that the "standard Erlang types"
are very ambiguous because there's no way to distinguish a list of
numbers and a string, and an empty proplist is indistinguishable from
an empty list. On top of that, if you were to support tuples as JSON
arrays then you would have another ambiguituy with the representation
of a proplist.


More information about the erlang-questions mailing list