libboost-json

[brief]

JSON parsing, serialization, and DOM in C++11

Boost.JSON

Branch master develop
Azure Build Status Build Status
Docs Documentation Documentation
Drone Build Status Build Status
Matrix Matrix Matrix
Fuzzing --- fuzz
Appveyor Build status Build status
codecov.io codecov codecov

Boost.JSON

Overview

Boost.JSON is a portable C++ library which provides containers and algorithms that implement JavaScript Object Notation, or simply "JSON", a lightweight data-interchange format. This format is easy for humans to read and write, and easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language (Standard ECMA-262), and is currently standardised in RFC 8259. JSON is a text format that is language-independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.

This library focuses on a common and popular use-case: parsing and serializing to and from a container called value which holds JSON types. Any value which 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.

The value container is designed to be well suited as a vocabulary type appropriate for use in public interfaces and libraries, allowing them to be composed. The library restricts the representable data types to the ranges which are almost universally accepted by most JSON implementations, especially JavaScript. The parser and serializer are both highly performant, meeting or exceeding the benchmark performance of the best comparable libraries. Allocators are very well supported. Code which uses these types will be easy to understand, flexible, and performant.

Boost.JSON offers these features:

Visit https://boost.org/libs/json for complete documentation.

Requirements

The library relies heavily on these well known C++ types in its interfaces (henceforth termed standard types):

Header-Only

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.

#include <boost/json/src.hpp>

MSVC users must also define the macro BOOST_JSON_NO_LIB to disable auto-linking.

Embedded

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:

#define BOOST_JSON_STACK_BUFFER_SIZE 1024
#include <boost/json/src.hpp>

Supported Compilers

Boost.JSON has been tested with the following compilers:

Supported JSON Text

The library expects input text to be encoded using UTF-8, which is a requirement put on all JSON exchanged between systems by the RFC. Similarly, the text generated by the library is valid UTF-8.

The RFC does not allow byte order marks (BOM) to appear in JSON text, so the library considers BOM syntax errors.

The library supports several popular JSON extensions. These have to be explicitly enabled.

Visual Studio Solution

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

Quality Assurance

The development infrastructure for the library includes these per-commit analyses:

License

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)

license BSL-1.0
project boost
url github.com/boostorg/json
doc-url www.boost.org/doc/libs/1_83_0/libs/json
topics C++Boost
4 Versions
version 1.78.0
repository https://pkg.cppget.org/1/stable
depends 9; libboost-align, libboost-assert, libboost-config, libboost-container, libboost-exception, libboost-mp11, libboost-system, libboost-throw-exception, libboost-utility
version 1.77.0+1
repository https://pkg.cppget.org/1/stable
depends 9; libboost-align, libboost-assert, libboost-config, libboost-container, libboost-exception, libboost-mp11, libboost-system, libboost-throw-exception, libboost-utility
version 1.83.0
repository https://pkg.cppget.org/1/stable
depends 10; libboost-align, libboost-assert, libboost-config, libboost-container, libboost-container-hash, libboost-core, libboost-describe, libboost-mp11, libboost-system, libboost-throw-exception
version 1.81.0+1
repository https://pkg.cppget.org/1/stable
depends 9; libboost-align, libboost-assert, libboost-config, libboost-container, libboost-core, libboost-describe, libboost-mp11, libboost-system, libboost-throw-exception