|
|
◆ to_string()
template<typename BasicJsonType >
- Invariant
- For each JSON pointer
ptr, it holds:
- Returns
- a string representation of the JSON pointer
- Example
- The example shows the result of
to_string. 2 #include <nlohmann/json.hpp> 23 std::cout << ptr1.to_string() << '\n' 24 << ptr2.to_string() << '\n' 25 << ptr3.to_string() << '\n' 26 << ptr4.to_string() << '\n' 27 << ptr5.to_string() << '\n' 28 << ptr6.to_string() << '\n' 29 << ptr7.to_string() << '\n' 30 << ptr8.to_string() << '\n' 31 << ptr9.to_string() << '\n' 32 << ptr10.to_string() << '\n' 33 << ptr11.to_string() << '\n' 34 << ptr12.to_string() << std::endl; basic_json<> json default JSON class
::nlohmann::json_pointer< basic_json > json_pointer JSON Pointer, see nlohmann::json_pointer.
Output (play with this example online):
/foo
/foo/0
/
/a~1b
/c%d
/e^f
/g|h
/i\j
/k"l
/
/m~0n
The example code above can be translated withg++ -std=c++11 -Isingle_include doc/examples/json_pointer__to_string.cpp -o json_pointer__to_string
- Since
- version 2.0.0
Definition at line 8473 of file json.hpp.
|