A simple c++17 json reader and writer.
Table of Contents:
Usage example is located in the examples folder.
By default, parsing is permissive and later values overwrite earlier ones if an object contains duplicate keys.
To enable strict parsing, pass parse_options with strict = true. In
strict mode, parsing fails with
bourne::error::parse_object_duplicate_key when duplicate keys are found.
bourne::json::parse_options options;
options.strict = true;
std::error_code error;
auto result = bourne::json::parse("{\"a\":1,\"a\":2}", options, error);
if (error == bourne::error::parse_object_duplicate_key)
{
// duplicate key found
}
Fetch the sources:
git clone https://github.com/steinwurf/bourne cd bourne
We use the waf build system to build the bourne static library. We
have some additional waf tools which can be found at waf.
To configure and build bourne, run the following commands:
python waf configure python waf build python waf install --destdir=/tmp
The final install step will create a folder containing all the
nessecary files needed to use the library (e.g. static library,
headers etc.). You can change the output folder by passing a different
path to --destdir:
To depend on this project when using the CMake build system, add the following in your CMake build script:
add_subdirectory("/path/to/bourne" bourne)
target_link_libraries(<my_target> steinwurf::bourne)
Where <my_target> is replaced by your target.
The code for this library have been inspired by the SimpleJSON library.
