I wrote a JSON library
w0rp
devw0rp at gmail.com
Tue May 7 14:09:35 PDT 2013
I completely missed something out there. Namely, my reasons why I
just didn't like the existing implementations enough. Overall,
the other libraries are all very similar, so I don't have major
complaints, just little ones.
For vibe.d, it's actually pretty close to what I wanted. My big
objection is that I don't like the 'Undefined' types. I would
rather experience runtime errors in those cases. I also have to
pretty much depend on Vibe to use it, rather than just a JSON
library. Aside from that, it's not far off from what I'm after.
For Libdjson, it uses classes to represent json types. That just
seems very awkward to use, and that shouts out "unnecessary
garbage creation" to me.
The standard library (std.json) seems to nail the parsing of
JSON, but lacks the ability to write a JSON string to an output
range, and doesn't really offer any conveniences for working with
the JSON data structure itself. std.json, vibe.d, and my own
representation of JSON are all very similar. They are tagged
unions implemented with union {} and an enum. What makes vibe.d
and my own library nice is all of the operator overloads,
properties, and convenience functions.
Another issue with std.json is lack of pretty-printing, which
both vibe.d and my own library address. (Mine has toJSON!4 and
writeJSON!8 for a string indented by 4 characters and writing to
an output range indented by 8 characters, respectively.)
So that's essentially my rationale. Overall, writing the library
was mostly done because I found it to be a rather entertaining
challenge for myself.
More information about the Digitalmars-d
mailing list