Namespaces | |
| namespace | detail |
Classes | |
| struct | Error |
| Various kinds of parse and IO errors. Contains contextual token and source location if parse error. More... | |
| class | Json |
| Library interface, represents a valid JSON value. More... | |
| struct | SerializeFlag |
| Bit flags for serialization options. More... | |
| struct | SerializeOptions |
| Serialization options. More... | |
| struct | SrcLoc |
| Source location. More... | |
| struct | StringHash |
| Heterogeneous string hasher. More... | |
Concepts | |
| concept | NumericT |
| Numeric type. | |
| concept | StringyT |
| Stringy type. | |
| concept | GettableT |
| Type to obtain JSON value as. | |
| concept | SettableT |
| Type to set JSON value to. | |
Typedefs | |
| using | Result = std::expected< Json, Error > |
| Parse result type. | |
| using | SerializeFlags = decltype(std::to_underlying(SerializeFlag::None)) |
| template<typename Value > | |
| using | StringTable = std::unordered_map< std::string, Value, StringHash, std::equal_to<> > |
| Heterogeneous string map. | |
Enumerations | |
| enum class | JsonType : std::int8_t { Null , Boolean , Number , String , Array , Object , COUNT_ } |
| JSON value type. More... | |
| enum class | ParseMode : std::int8_t { Auto , Strict , Jsonc } |
| Parse mode. More... | |
Functions | |
| auto | to_string_view (Error::Type type) -> std::string_view |
| Obtain stringified Error Type. | |
| auto | to_string (Error const &error) -> std::string |
| Obtain print-friendly error string. | |
| auto | to_string (Json const &json, SerializeOptions const &options={}) |
| auto | make_escaped (std::string_view text) -> std::string |
| Convert input text to escaped string. | |
| template<GettableT Type> | |
| void | from_json (Json const &json, Type &value, Type const fallback={}) |
| Assign JSON as value. | |
| template<SettableT Type> | |
| void | to_json (Json &json, Type const &value) |
| Assign value to JSON. | |
Variables | |
| constexpr auto | serialize_flags_v = SerializeFlag::SortKeys | SerializeFlag::TrailingNewline |
| Default serialize flags. | |
| using dj::Result = typedef std::expected<Json, Error> |
Parse result type.
| using dj::SerializeFlags = typedef decltype(std::to_underlying(SerializeFlag::None)) |
| using dj::StringTable = typedef std::unordered_map<std::string, Value, StringHash, std::equal_to<> > |
Heterogeneous string map.
|
strong |
|
strong |
| void dj::from_json | ( | Json const & | json, |
| Type & | value, | ||
| Type const | fallback = {} |
||
| ) |
Assign JSON as value.
| auto dj::make_escaped | ( | std::string_view | text | ) | -> std::string |
Convert input text to escaped string.
| void dj::to_json | ( | Json & | json, |
| Type const & | value | ||
| ) |
Assign value to JSON.
| auto dj::to_string | ( | Error const & | error | ) | -> std::string |
Obtain print-friendly error string.
|
inline |
| auto dj::to_string_view | ( | Error::Type | type | ) | -> std::string_view |
Obtain stringified Error Type.
|
inlineconstexpr |
Default serialize flags.