Andrej Mitrovic wrote:
On 12/1/11, Kai Meyer<k...@unixlords.com> wrote:
I'm finding std.json extremely well written, with one glaring exception.
I'm finding it to be crap. The last time I used it I just kept getting
access violations (or was that std.xml? They're both crap when I used
them.). ae.json beats its pants off for its simplicity + you get
toJson/jsonParse for serialization and a way to skip serializing
fields since a recent commit . It's easy to write your own
tree-walking routines as well.
But whatever works for people. :)
I have written streaming json parser using ranges. It returns slices
when possible. Benchmarked it and it's about 2.05x the speed of std.json.
It gives possibility to "dig" into the structure and stream (using
ranges) by member fields, array elements, or characters of field names
and string values. It's possible to parse JSON without a single
allocation. For convenience, one can get objects, arrays and strings as
a whole.
I plan to add a streaming json writer and release it (currently it
outputs json using toString()). I've seen questions on stackoverflow
about parsing 500 MB JSON... so streaming feature makes it really
universal. This approach should be good for XML parser too.
Currently, I don't have time to improve it. But if someone is interested
I can send it as is :-)