JSON for Modern C++ 3.7.1

back
basic_json
empty
json_pointer
operator std::string
operator!=
operator/
operator/
operator/
operator/=
operator/=
operator/=
operator==
parent_pointer
pop_back
push_back
push_back
to_string
| ## ◆ parent_pointer() template<typename BasicJsonType >
json_pointer nlohmann::json_pointer< BasicJsonType >::parent_pointer | ( |  | ) | const
| inline
  Returns parent of this JSON pointer; in case this JSON pointer is the root, the root itself is returned Complexity Linear in the length of the JSON pointer. Example The example shows the result of `parent_pointer` for different JSON Pointers. 1 #include <iostream> 2 #include <nlohmann/json.hpp> 3 4 using json = nlohmann::json; 5 6 int main() 7 { 8 // different JSON Pointers 9 json::json_pointer ptr1(""); 10 json::json_pointer ptr2("/foo"); 11 json::json_pointer ptr3("/foo/0"); 12 13 // call parent_pointer() 14 std::cout << std::boolalpha 15 << "parent of " << ptr1 << " is " << ptr1.parent_pointer() << '\n' 16 << "parent of " << ptr2 << " is " << ptr2.parent_pointer() << '\n' 17 << "parent of " << ptr3 << " is " << ptr3.parent_pointer() << std::endl; 18 } Output (play with this example online):
      parent of "" is ""
      parent of "/foo" is ""
      parent of "/foo/0" is "/foo"
  The example code above can be translated with
      g++ -std=c++11 -Isingle_include doc/examples/json_pointer__parent_pointer.cpp -o json_pointer__parent_pointer
Since version 3.6.0 Definition at line 10295 of file json.hpp.

nlohmann::basic_json::json_pointer
::nlohmann::json_pointer< basic_json > json_pointer
JSON Pointer, see nlohmann::json_pointer.
Definition: json.hpp:14753
nlohmann::json
basic_json<> json
default JSON class
Definition: json.hpp:2445