A C++11 or library for parsing and serializing JSON to and from a DOM container in memory.
This library focuses on a common and popular use-case: parsing and serializing to and from a container called
valuewhich holds JSON types. Any
valuewhich you build can be serialized and then deserialized, guaranteeing that the result will be equal to the original value. Whatever JSON output you produce with this library will be readable by most common JSON implementations in any language.
Boost.JSON offers these features:
The library relies heavily on these well known C++ types in its interfaces (henceforth termed standard types):
The requirements for Boost.JSON depend on whether the library is used as part of Boost, or in the standalone flavor (without Boost):
Warning: standalone use is deprecated and will be removed in a future release of Boost.JSON.
When using without Boost, support foris required. In particular, if using libstdc++ then version 8.3 or later is needed.
To use as header-only; that is, to eliminate the requirement to link a program to a static or dynamic Boost.JSON library, simply place the following line in exactly one new or existing source file in your project. ```
### Standalone Shared Library
> Warning: standalone use is deprecated and will be removed in a future release > of Boost.JSON.
To build a standalone shared library, it is necessary to define the macros
BOOST_JSON_CLASS_DECLas appropriate for your toolchain. Example for MSVC:
// When building the DLL
// When building the application which uses the DLL
Boost.JSON works great on embedded devices. The library uses local stack buffers to increase the performance of some operations. On Intel platforms these buffers are large (4KB), while on non-Intel platforms they are small (256 bytes). To adjust the size of the stack buffers for embedded applications define this macro when building the library or including the function definitions:
#### Note This library uses separate inline namespacing for the standalone mode to allow libraries which use different modes to compose without causing link errors. Linking to both modes of Boost.JSON (Boost and standalone) is possible, but not recommended.
Boost.JSON has been tested with the following compilers:
The development infrastructure for the library includes these per-commit analyses:
cmake -G "Visual Studio 16 2019" -A Win32 -B bin -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/msvc.cmake cmake -G "Visual Studio 16 2019" -A x64 -B bin64 -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/msvc.cmake