JSON Pointer defines a string syntax for identifying a specific value within a JSON document.
More...
|
template<typename BasicJsonType> |
BasicJsonType & | get_and_create (BasicJsonType &j) const |
| create and return a reference to the pointed to value
|
|
template<typename BasicJsonType> |
BasicJsonType & | get_unchecked (BasicJsonType *ptr) const |
| return a reference to the pointed to value
|
|
template<typename BasicJsonType> |
BasicJsonType & | get_checked (BasicJsonType *ptr) const |
|
template<typename BasicJsonType> |
const BasicJsonType & | get_unchecked (const BasicJsonType *ptr) const |
| return a const reference to the pointed to value
|
|
template<typename BasicJsonType> |
const BasicJsonType & | get_checked (const BasicJsonType *ptr) const |
|
template<typename BasicJsonType> |
bool | contains (const BasicJsonType *ptr) const |
|
json_pointer< string_t > | convert () const & |
|
json_pointer< string_t > | convert () && |
|
|
template<typename BasicJsonType> |
static BasicJsonType::size_type | array_index (const string_t &s) |
|
static std::vector< string_t > | split (const string_t &reference_string) |
| split the string input to reference tokens
|
|
template<typename BasicJsonType> |
static void | flatten (const string_t &reference_string, const BasicJsonType &value, BasicJsonType &result) |
|
template<typename BasicJsonType> |
static BasicJsonType | unflatten (const BasicJsonType &value) |
|
|
class | basic_json |
|
template<typename> |
class | json_pointer |
|
std::ostream & | operator<< (std::ostream &o, const json_pointer &ptr) |
| write string representation of the JSON pointer to stream
|
|
json_pointer | operator/ (const json_pointer &lhs, const json_pointer &rhs) |
| create a new JSON pointer by appending the right JSON pointer at the end of the left JSON pointer
|
|
json_pointer | operator/ (const json_pointer &lhs, string_t token) |
| create a new JSON pointer by appending the unescaped token at the end of the JSON pointer
|
|
json_pointer | operator/ (const json_pointer &lhs, std::size_t array_idx) |
| create a new JSON pointer by appending the array-index-token at the end of the JSON pointer
|
|
template<typename RefStringTypeLhs, typename RefStringTypeRhs> |
bool | operator== (const json_pointer< RefStringTypeLhs > &lhs, const json_pointer< RefStringTypeRhs > &rhs) |
| compares two JSON pointers for equality
|
|
template<typename RefStringTypeLhs, typename StringType> |
bool | operator== (const json_pointer< RefStringTypeLhs > &lhs, const StringType &rhs) |
| compares JSON pointer and string for equality
|
|
template<typename RefStringTypeRhs, typename StringType> |
bool | operator== (const StringType &lhs, const json_pointer< RefStringTypeRhs > &rhs) |
| compares string and JSON pointer for equality
|
|
template<typename RefStringTypeLhs, typename RefStringTypeRhs> |
bool | operator!= (const json_pointer< RefStringTypeLhs > &lhs, const json_pointer< RefStringTypeRhs > &rhs) |
| compares two JSON pointers for inequality
|
|
template<typename RefStringTypeLhs, typename StringType> |
bool | operator!= (const json_pointer< RefStringTypeLhs > &lhs, const StringType &rhs) |
| compares JSON pointer and string for inequality
|
|
template<typename RefStringTypeRhs, typename StringType> |
bool | operator!= (const StringType &lhs, const json_pointer< RefStringTypeRhs > &rhs) |
| compares string and JSON pointer for inequality
|
|
template<typename RefStringTypeLhs, typename RefStringTypeRhs> |
bool | operator< (const json_pointer< RefStringTypeLhs > &lhs, const json_pointer< RefStringTypeRhs > &rhs) |
| compares two JSON pointer for less-than
|
|
template<typename RefStringType>
class json_pointer< RefStringType >
JSON Pointer defines a string syntax for identifying a specific value within a JSON document.
- See also
- https://json.nlohmann.me/api/json_pointer/
Definition at line 13840 of file json.hpp.
template<typename RefStringType>
template<typename BasicJsonType>
BasicJsonType & json_pointer< RefStringType >::get_and_create |
( |
BasicJsonType & | j | ) |
const |
|
inlineprivate |
create and return a reference to the pointed to value
@complexity Linear in the number of reference tokens.
- Exceptions
-
parse_error.109 | if array index is not a number |
type_error.313 | if value cannot be unflattened |
Definition at line 14079 of file json.hpp.
template<typename RefStringType>
template<typename BasicJsonType>
BasicJsonType & json_pointer< RefStringType >::get_unchecked |
( |
BasicJsonType * | ptr | ) |
const |
|
inlineprivate |
return a reference to the pointed to value
- Note
- This version does not throw if a value is not present, but tries to create nested values instead. For instance, calling this function with pointer
"/this/that"
on a null value is equivalent to calling operator[]("this").operator[]("that")
on that value, effectively changing the null value to an object.
- Parameters
-
- Returns
- reference to the JSON value pointed to by the JSON pointer
@complexity Linear in the length of the JSON pointer.
- Exceptions
-
parse_error.106 | if an array index begins with '0' |
parse_error.109 | if an array index was not a number |
out_of_range.404 | if the JSON pointer can not be resolved |
Definition at line 14159 of file json.hpp.