<div dir="ltr"><p>Hi all,</p>
<p>I have uploaded a json parser to trapexit. (<a href="http://forum.trapexit.org/viewtopic.php?p=44029#44029">http://forum.trapexit.org/viewtopic.php?p=44029#44029</a>)</p>
<p>More than anything else, the purpose of this parser is to convince Richard O'Keefe that having a json parser with a SAX-like API is a good idea. But fortunately it can also serve more practical purposes.</p>
<p>As mentioned, the parser has a SAX-like API. It also has a mechanism to parse input data in blocks - if it reaches the end of the input data, it will call a function to provide the next block. The combination of these properties results in a parser that can process input of <br>
arbitrary size, or a stream of data.</p>
<p>Included is a handler function that translates the SAX events into the same output format produced by mochijson2. Looks like this: {struct, [{<<"key1">>, <<"value1">>}, {<<"key2">>, 123}]}. Interestingly, the new parser (sax parser combined with handler) is roughly 2x as fast as mochijson2 (On my PC, at least). </p>

<p>The parser consists of just 1 file, with some edoc documentation and a couple of very simple examples included. It only works on UTF-8 encoded input (which implies that it can also parse ASCII, of course).</p>
<div>Regards,</div>
<div>Willem</div></div>