<div dir="ltr">On Fri, Aug 30, 2013 at 2:57 PM, Loïc Hoguin <span dir="ltr"><<a href="mailto:essen@ninenines.eu" target="_blank">essen@ninenines.eu</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Mark, long time no see!<div class="im"><br>
<br>
On 08/30/2013 10:41 PM, Garrett Smith wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Mark,<br>
<br>
On Fri, Aug 30, 2013 at 3:22 PM, Mark Allen <<a href="mailto:mallen@alertlogic.com" target="_blank">mallen@alertlogic.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am wondering if anyone has opinions on how to deserialize JSON HTTP request bodies into Erlang terms. Tuple wrapped proplists seems to be how it comes back from mochijson2:decode() and jiffy:decode(). Erlson returns orddicts hidden in a record-like syntax via a parse-transform.<br>
</blockquote>
<br>
It's initially odd, but {Proplist} has emerged as a standard-ish<br>
representation of a JSON associative array in Erlang. It's better IMO<br>
than dealing with the "what is this list - a string or an array?"<br>
question.<br>
</blockquote>
<br></div>
The question doesn't come up in jsx because it doesn't use strings. So you got Proplist instead of {Proplist} and <<"string">> instead of "string". The JSON is still checked to be valid utf-8 even if it gives you binaries at the end so no functionality is lost.<br>
<br>
I don't think one is more used than the other though.</blockquote><div><br></div><div>How are 0-length arrays distinguished from 0-length proplists? This is why mochijson2 wraps proplists as {struct,P}. It also uses binaries for strings, and validates the UTF8.</div>
<div><br></div><div>-bob</div><div><br></div></div></div></div>