json_pack
and json_unpack
similarly
serialises/deserialises to the JSON5 format, and has similar
advantages to XML form for schema miration and configuration
editing. JSON is a more compact, and more human friendly format than
XML, but has one deficiency with respect to XML. For a class derived
from a standard container (eg std::vector) the JSON representation
will be a JSON list object, and cannot represent any members of the
derived class.
JSON5 is a strict superset of JSON. It is much more relaxed about
allowing single quotes as equivalent to double quotes, inline comments
using //
, /*
and */
. json_pack
leverages
the json5_parser
project, and produces standard JSON
output. There is only one issue - floating point values of Inf and NaN
are unrepresentable in JSON, but are representable in JSON5. So if
your data contains these values, you will not be able to import them
using a standard JSON decoder, but must use a JSON5 decoder instead.
The json_pack
serialiser requires the use of the Boost spirit
library to be installed (part of the boost_headers package).
It is usual (though not necessary) to only serialise public members of classes.