[erlang-questions] JSON encoding of arrays of arrays

Joseph Wayne Norton norton@REDACTED
Fri Oct 22 11:43:44 CEST 2010


Not sure if this is helpful or not to this discussion.

For integrating the UBF framework with JSON over TCP/IP and JSON-RPC over  
HTTP, we choose a particular representation for mapping tuples, atoms, and  
records.  The comments at the top of this erlang module describe the  
mapping.

   http://github.com/norton/ubf-jsonrpc/blob/master/src/jsf.erl

There is also (some) notes in the README that describe the approach taken:

   http://github.com/norton/ubf-jsonrpc

We are also using the mochijson2 encoder/decoder (thanks!).

thanks,

On Fri, 22 Oct 2010 18:29:07 +0900, Bob Ippolito <bob@REDACTED> wrote:

> 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.
>
> -bob
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>


-- 
norton@REDACTED


More information about the erlang-questions mailing list