[erlang-questions] fast JSON parser in C

Patrick Logan <>
Fri Jul 25 19:41:06 CEST 2008


"As far as sorting goes, I'd think it would be better not to
automatically reorder, as the user can do that if necessary, and while
the JSON spec doesn't preserve order, at least a few of the JS
interpreters do (including Spidermonkey, used by CouchDB). I don't
know if anyone is leaning on that feature yet, but it seems
potentially useful."

I'm not sure what is meant by "preserve order" in regard to the JSON
spec. The spec only documents an interchange format. In JSON there is
no concept of "preservation" of _anything_ because JSON does not
describe "changes" of anything over time. A JSON formatted sequence of
characters is "a one tiime thing".

If this is intended to mean...

json -> erlang -> json

results in a json sequence of characters describing a json object
whose members occur in the same sequence as the sequence found in the
json input, then that seems more expensive than necessary. Hopefully
no one in any language implementation is relying on that at an
interoperability level.

If you want to preserve order, that is exactly what the json array is for.

-Patrick



More information about the erlang-questions mailing list