I've seen the C++ JSON links on www.json.org but would like some feedback on which parser people prefer - for reliability, speed and ease of use.
Thanks, Sam
I've seen the C++ JSON links on www.json.org but would like some feedback on which parser people prefer - for reliability, speed and ease of use.
Thanks, Sam
I looked at most of them a year or so ago, and settled on JsonCpp (http://jsoncpp.sourceforge.net/). I've found it reliable, fast and easy to use, so 3/3.
I'm using JSON Spirit on a project at the moment, I'm impressed with it so far.
Note that it does rely on Boost (if only for headers).
Handy features:
write_formatted
).Note that Objects are also implemented using vector (not map), which means slower access, but it does mean that the order of elements is maintained.
See also Boost property_tree included in the 1.41.0 release of Boost:
http://www.boost.org/doc/libs/1_41_0/doc/html/property_tree.html
Basically it provides a generic property tree structure and includes parses/generators for JSON, XML and INI. It is header only and it uses Boost Spirit for generation/parsing.
I just gave JSON Spirit (the header-only version) a try, because I was already using Boost in my project and JSON Spirit only depends on Boost.
However, I think the documentation (especially for the new header-only version) is not adequate at the moment. Maybe this will change.
I know you are asking about the C++, but yajl is definitely worth to try as well. It has many features that is not available from many other parsers, and the most important, it's fast.