JSON Pointer defines a string syntax for identifying a specific value within a JSON document.
More...
#include <json.hpp>
template<typename BasicJsonType>
class nlohmann::json_pointer< BasicJsonType >
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 3331 of file json.hpp.
◆ json_pointer()
template<typename BasicJsonType >
◆ array_index()
template<typename BasicJsonType >
- Parameters
-
[in] | s | reference token to be converted into an array index |
- Returns
- integer representation of s
- Exceptions
-
parse_error.106 | if an array index begins with '0' |
parse_error.109 | if an array index begins not with a digit |
out_of_range.404 | if string s could not be converted to an integer |
out_of_range.410 | if an array index exceeds size_type |
Definition at line 12408 of file json.hpp.
◆ back()
template<typename BasicJsonType >
◆ BasicJsonType()
template<typename BasicJsonType >
◆ contains()
template<typename BasicJsonType >
- Exceptions
-
parse_error.106 | if an array index begins with '0' |
parse_error.109 | if an array index was not a number |
Definition at line 12772 of file json.hpp.
◆ empty()
template<typename BasicJsonType >
◆ flatten()
template<typename BasicJsonType >
- Parameters
-
[in] | reference_string | the reference string to the current value |
[in] | value | the value to consider |
[in,out] | result | the result object to insert values to |
- Note
- Empty objects or arrays are flattened to
null
.
Definition at line 12928 of file json.hpp.
◆ get_and_create()
template<typename BasicJsonType >
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 12473 of file json.hpp.
◆ get_checked() [1/2]
template<typename BasicJsonType >
- 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.402 | if the array index '-' is used |
out_of_range.404 | if the JSON pointer can not be resolved |
Definition at line 12619 of file json.hpp.
◆ get_checked() [2/2]
template<typename BasicJsonType >
- 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.402 | if the array index '-' is used |
out_of_range.404 | if the JSON pointer can not be resolved |
Definition at line 12724 of file json.hpp.
◆ get_unchecked() [1/2]
template<typename BasicJsonType >
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 12552 of file json.hpp.
◆ get_unchecked() [2/2]
template<typename BasicJsonType >
return a const reference to the pointed to value
- Parameters
-
- Returns
- const reference to the JSON value pointed to by 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.402 | if the array index '-' is used |
out_of_range.404 | if the JSON pointer can not be resolved |
Definition at line 12676 of file json.hpp.
◆ operator std::string()
template<typename BasicJsonType >
◆ operator/=() [1/3]
template<typename BasicJsonType >
◆ operator/=() [2/3]
template<typename BasicJsonType >
◆ operator/=() [3/3]
template<typename BasicJsonType >
◆ parent_pointer()
template<typename BasicJsonType >
◆ pop_back()
template<typename BasicJsonType >
◆ push_back() [1/2]
template<typename BasicJsonType >
◆ push_back() [2/2]
template<typename BasicJsonType >
◆ split()
template<typename BasicJsonType >
split the string input to reference tokens
- Note
- This function is only called by the json_pointer constructor. All exceptions below are documented there.
- Exceptions
-
parse_error.107 | if the pointer is not empty or begins with '/' |
parse_error.108 | if character '~' is not followed by '0' or '1' |
Definition at line 12860 of file json.hpp.
◆ to_string()
template<typename BasicJsonType >
◆ unflatten()
template<typename BasicJsonType >
- Parameters
-
- Returns
- unflattened JSON
- Exceptions
-
parse_error.109 | if array index is not a number |
type_error.314 | if value is not an object |
type_error.315 | if object values are not primitive |
type_error.313 | if value cannot be unflattened |
Definition at line 12999 of file json.hpp.
◆ basic_json
template<typename BasicJsonType >
◆ operator!=
template<typename BasicJsonType >
compares two JSON pointers for inequality
- Parameters
-
[in] | lhs | JSON pointer to compare |
[in] | rhs | JSON pointer to compare |
- Returns
- whether lhs is not equal rhs
@complexity Linear in the length of the JSON pointer
@exceptionsafety No-throw guarantee: this function never throws exceptions.
Definition at line 13054 of file json.hpp.
◆ operator/ [1/3]
template<typename BasicJsonType >
◆ operator/ [2/3]
template<typename BasicJsonType >
◆ operator/ [3/3]
template<typename BasicJsonType >
◆ operator==
template<typename BasicJsonType >
compares two JSON pointers for equality
- Parameters
-
[in] | lhs | JSON pointer to compare |
[in] | rhs | JSON pointer to compare |
- Returns
- whether lhs is equal to rhs
@complexity Linear in the length of the JSON pointer
@exceptionsafety No-throw guarantee: this function never throws exceptions.
Definition at line 13037 of file json.hpp.
◆ __pad0__
template<typename BasicJsonType >
◆ parent
template<typename BasicJsonType >
◆ reference_tokens [1/2]
template<typename BasicJsonType >
◆ reference_tokens [2/2]
template<typename BasicJsonType >
◆ result [1/2]
template<typename BasicJsonType >
◆ result [2/2]
template<typename BasicJsonType >
The documentation for this class was generated from the following file: