Naughter Software Logo

JSON++ v1.01 A set of C++ classes to support JSON

I have been working with JSON recently in a number of C++ projects and wanted to learn it by understanding the JSON specification by writing my own JSON parser / encoder. There are a number of nice JSON libraries for C++ out there such as SimpleJSON and JSON for Modern C++. I particularly liked the SimpleJSON library which was able to implement a nice JSON parser / encoder in c. 1300 lines of code. I decided to write my own class based on SimpleJSON but using some modern C++ features such as r-value references, move constructors and operator=. Thus was born JSON++. Included in the download is the JSON++ source code and a VC 2017 application to fully exercise all the functionality of JSON++. The main class provided is CValue and is implemented in a JSONPP namespace. All the constructors of the CValue class allow a JSON value object to be constructed directly from other C++ types such as bool, double, long, STL strings, STL vectors, STL maps etc. Standard C++ operator= methods are also provided which mirror the constructor methods. The class also supports construction and assignment from C++ r-value references. A "Parse" method of CValue allows a JSON encoded string (either UTF8 or UTF16) to be parsed into the CValue instance. An "Encode" method allows a JSON encoded string in the form of a std::wstring to be created from a CValue instance. Various other CValue methods are modeled on the SimpleJSON classes.




The enclosed zip file contains the JSON++ source code and a VC 2017 console based application with exercises all of the JSON++ functionality.







8 February 2018

v1.01 (10 January 2018)

V1.0 (25 November 2017)