Skip to content

Engine → Core

document.h

JSON documents.

Structs

File Description
json::init_member One {"key", value} entry of the object() builder.

Classes

File Description
json::document An owning, mutable JSON document.
json::init_value One argument of the object()/array() builders. Implicitly constructed from every scalar type the mutation API accepts, from a document (copied or moved) and from a value (copied). A null C string becomes JSON null, as in the mutation API. Intended only as a builder argument; do not store it.

Type Aliases

json::detail::widened_integer

template <std::integral T> using widened_integer = std::conditional_t<std::is_signed_v<T>, i64, u64>;

i64 for signed integral types, u64 for unsigned ones; the storage width of the API.

json::init_value::storage

using storage = std::variant<std::nullptr_t, bool, i64, u64, f64, std::string, document, value>;

Concepts

json::detail::other_integer

template <typename T> concept other_integer = std::integral<T> && !std::same_as<T, bool> && !std::same_as<T, i32> && !std::same_as<T, u32> && !std::same_as<T, i64> && !std::same_as<T, u64>;

Integral types that are not bool and have no dedicated overload of their own.

Constants

Name Type Value Description
json::MAX_NESTING_DEPTH inline constexpr usize 1024 Deepest container nesting a parsed document may have: "[]" is depth 1, "[[]]" depth 2, a scalar root depth 0. Sized so yyjson's recursive copy fits a 512 KiB thread stack in Debug.

Functions

Public

json::array

[[nodiscard]] CONJURE_API document array(std::initializer_list<init_value> items);
[[nodiscard]] CONJURE_API document array(std::initializer_list<init_value> items);

Builds an array document: json::array({1, 2.5, "three", nullptr}).

json::object

[[nodiscard]] CONJURE_API document object(std::initializer_list<init_member> members);
[[nodiscard]] CONJURE_API document object(std::initializer_list<init_member> members);

Builds an object document: json::object({{"a", 1}, {"b", "x"}, {"c", json::array({1, 2})}}).