[erlang-questions] fast JSON parser in C
Thu Jul 24 12:49:28 CEST 2008
Since JSON seem to be ubiquitous is seems to me that there would be
a strong case for a couple of new BIFs, term_to_json and json_to_term.
these would work like binary_to_term and term_to_binary the difference
instead of converting to a binary containing the external term format,
to a binary containing a JSON encoded string.
I imaging that modeling this code on the existing term_to_binary and
code would not be impossibly difficult (you have to make it reentrant
and not to
not hog the CPU for too long ... and so on ...)
And yes - it is pretty horrid increasing the number of BIFs but this
might just be
a useful addition.
This would ease seamless integration with a lot of external programs :-)
On Thu, Jul 24, 2008 at 11:02 AM, Martin Carlson
> You might want to go with the ei interface rather than the erl_interface
> since it is not as clumsy to use. Further, you might want to have a look
> at the ejabberd expat driver and just replace the expat stuff with your
> json SAX events.
> Chris Anderson wrote:
>> On Wed, Jul 23, 2008 at 1:49 PM, Jonathan Gray <> wrote:
>>> However when I get a big chunk (around 80-120K) directly from Erlang as
>>> binary (using term_to_binary in erlang), I'm unable to decode it using
>>> erl_interface erl_decode, though it can be decoded fine from within Erlang.
>> Good to know - CouchDB's Erlang -> JSON encoding is fast enough to not
>> need help from C. I'm just working on making the JSON -> Erlang fast
>> enough, so as long as I can get string buffers over to C in the first
>> place, it sounds like you're not having a problem moving data from C
>> back to Erlang.
>> Time to buckle down and code!
> erlang-questions mailing list
More information about the erlang-questions