When writing JSON messages, some C/C++ libraries work by building an in-memory object for the sole purpose of serialising it as JSON. Many libraries comprise multiple header and source files and/or expose a complex API.
minijson_writer is a simple decorator around a std::ostream. It directly writes on the stream without allocating additional memory, and does not throw exceptions unless the stream does.
Despite being a single header file of ~500 lines, minijson_writer is complete and can be easily extended to support custom types.
0.925 Jan 2015 22:09