mochijson2 is what I tell anyone who asks to use. Representing strings as
binaries avoids a whole host of data mangling problems when you have to deal
with non-ASCII or non- ISO-8859 character sets. Strings as binaries also frees
up lists to be interpreted as JSON arrays. This simplifies the data
representation since the only annotation you have to provide is on hashes aka
structs:
{struct, [{username, <<"jdoe">>}, {first_name, <<"John">>}, {last_name,
<<"Doe">>}]}
translates to:
{"username": "jdoe",
"first_name": "John",
"last_name": "Doe"}
mochijson requires, if I remember correctly, annotations for both arrays and
structs which is more "noisy" when you're doing lots of encoding and decoding.
--Kevin
On Jul 29, 2010, at 2:09 AM, Dan Reverri wrote:
> Hi Wilson,
>
> Mochijson is a popular choice. I would recommend using mochijson2 because it
> handles strings as binaries.
>
> There is also erlang-rfc4627 which I have not used but looks pretty good:
> http://tonyg.github.com/erlang-rfc4627/
>
>
> Daniel Reverri
> Developer Advocate
> Basho Technologies, Inc.
> [email protected]
>
>
> On Wed, Jul 28, 2010 at 10:46 PM, Dmitry Demeshchuk <[email protected]>
> wrote:
> mochijson.erl and mochijson2.erl are used by RIak itself, you can use them.
>
> As for me, I prefer the first one, as the second one requires
> converting JSON strings to binaries.
>
> On Thu, Jul 29, 2010 at 9:11 AM, Wilson MacGyver <[email protected]> wrote:
> > At the risk of somewhat off topic, what JSON lib does everyone use with the
> > Erlang riak client?
> >
> > _______________________________________________
> > riak-users mailing list
> > [email protected]
> > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> >
>
>
>
> --
> Best regards,
> Dmitry Demeshchuk
>
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com