simdjson
3.11.0
Ridiculously Fast JSON
|
JSON object. More...
Classes | |
class | iterator |
Public Member Functions | |
simdjson_inline | object () noexcept |
Create a new, invalid object. | |
iterator | begin () const noexcept |
Return the first key/value pair. More... | |
iterator | end () const noexcept |
One past the last key/value pair. More... | |
size_t | size () const noexcept |
Get the size of the object (number of keys). More... | |
simdjson_result< element > | operator[] (std::string_view key) const noexcept |
Get the value associated with the given key. More... | |
simdjson_result< element > | operator[] (const char *key) const noexcept |
Get the value associated with the given key. More... | |
simdjson_result< element > | operator[] (int) const noexcept=delete |
simdjson_result< element > | at_pointer (std::string_view json_pointer) const noexcept |
Get the value associated with the given JSON pointer. More... | |
simdjson_result< element > | at_path (std::string_view json_path) const noexcept |
Get the value associated with the given JSONPath expression. More... | |
simdjson_result< element > | at_key (std::string_view key) const noexcept |
Get the value associated with the given key. More... | |
simdjson_result< element > | at_key_case_insensitive (std::string_view key) const noexcept |
Get the value associated with the given key in a case-insensitive manner. More... | |
operator element () const noexcept | |
Implicitly convert object to element. | |
|
inlinenoexcept |
Get the value associated with the given key.
The key will be matched against unescaped JSON:
dom::parser parser; int64_t(parser.parse(R"({ "a
": 1 })"_padded)["a\n"]) == 1 parser.parse(R"({ "a
": 1 })"_padded)["a\\n"].get_uint64().error() == NO_SUCH_FIELD
This function has linear-time complexity: the keys are checked one by one.
Definition at line 146 of file object-inl.h.
|
inlinenoexcept |
Get the value associated with the given key in a case-insensitive manner.
It is only guaranteed to work over ASCII inputs.
Note: The key will be matched against unescaped JSON.
This function has linear-time complexity: the keys are checked one by one.
Definition at line 158 of file object-inl.h.
|
inlinenoexcept |
Get the value associated with the given JSONPath expression.
We only support JSONPath queries that trivially convertible to JSON Pointer queries: key names and array indices.
https://datatracker.ietf.org/doc/html/draft-normington-jsonpath-00
Definition at line 140 of file object-inl.h.
|
inlinenoexcept |
Get the value associated with the given JSON pointer.
We use the RFC 6901 https://tools.ietf.org/html/rfc6901 standard, interpreting the current node as the root of its own JSON document.
dom::parser parser; object obj = parser.parse(R"({ "foo": { "a": [ 10, 20, 30 ] }})"_padded); obj.at_pointer("/foo/a/1") == 20 obj.at_pointer("/foo")["a"].at(1) == 20
It is allowed for a key to be the empty string:
dom::parser parser; object obj = parser.parse(R"({ "": { "a": [ 10, 20, 30 ] }})"_padded); obj.at_pointer("//a/1") == 20 obj.at_pointer("/")["a"].at(1) == 20
Definition at line 95 of file object-inl.h.
|
inlinenoexcept |
Return the first key/value pair.
Part of the std::iterable interface.
Definition at line 76 of file object-inl.h.
|
inlinenoexcept |
One past the last key/value pair.
Part of the std::iterable interface.
Definition at line 80 of file object-inl.h.
|
inlinenoexcept |
Get the value associated with the given key.
The key will be matched against unescaped JSON:
dom::parser parser; int64_t(parser.parse(R"({ "a
": 1 })"_padded)["a\n"]) == 1 parser.parse(R"({ "a
": 1 })"_padded)["a\\n"].get_uint64().error() == NO_SUCH_FIELD
This function has linear-time complexity: the keys are checked one by one.
Definition at line 92 of file object-inl.h.
|
inlinenoexcept |
Get the value associated with the given key.
The key will be matched against unescaped JSON:
dom::parser parser; int64_t(parser.parse(R"({ "a
": 1 })"_padded)["a\n"]) == 1 parser.parse(R"({ "a
": 1 })"_padded)["a\\n"].get_uint64().error() == NO_SUCH_FIELD
This function has linear-time complexity: the keys are checked one by one.
Definition at line 89 of file object-inl.h.
|
inlinenoexcept |
Get the size of the object (number of keys).
It is a saturated value with a maximum of 0xFFFFFF: if the value is 0xFFFFFF then the size is 0xFFFFFF or greater.
Definition at line 84 of file object-inl.h.