July 06, 2009

PicoJSON, a header-file-only JSON parser in C++

Last week I had been looking for a tiny JSON parser written in C++, but was not able find one that met my needs (jsonxx was the most interesting, I took its is<type> and get<type> interfaces).  So instead I wrote my own, and that is PicoJSON.  The advantages of PicoJSON over other C++ JSON parsers are as follows.

  • C++ header-only implementation (just include the header file from your source code and that's it)
  • standalone (does not depend on other libraries like boost)
  • integration with STL (JSON array represented as std::vector, JSON object as std::map)
  • operator<<, operator>> and iterator based parser / serializer interface
  • provided under the New BSD License

The header file is available from coderepos (link).  Please read the examples included to find out how to use the library.

Related Articles: