JSON for Modern C++ 2.1.1

basic_json
json_pointer
operator std::string
operator!=
operator==
to_string
| ## ◆ operator std::string() template<template< typename U, typename V, typename... Args > class ObjectType = std::map, template< typename U, typename... Args > class ArrayType = std::vector, class StringType = std::string, class BooleanType = bool, class NumberIntegerType = std::int64_t, class NumberUnsignedType = std::uint64_t, class NumberFloatType = double, template< typename U > class AllocatorType = std::allocator, template< typename T, typename SFINAE=void > class JSONSerializer = adl_serializer>
nlohmann::basic_json::json_pointer::operator std::string | ( |  | ) | const
| inline
  Invariant For each JSON pointer `ptr`, it holds: ptr == json_pointer(ptr.to_string()); Returns a string representation of the JSON pointer Example The example shows the result of `to_string`. 1 #include "json.hpp" 2 3 using json = nlohmann::json; 4 5 int main() 6 { 7 // different JSON Pointers 8 json::json_pointer ptr1(""); 9 json::json_pointer ptr2("/foo"); 10 json::json_pointer ptr3("/foo/0"); 11 json::json_pointer ptr4("/"); 12 json::json_pointer ptr5("/a~1b"); 13 json::json_pointer ptr6("/c%d"); 14 json::json_pointer ptr7("/e^f"); 15 json::json_pointer ptr8("/g|h"); 16 json::json_pointer ptr9("/i\\j"); 17 json::json_pointer ptr10("/k\"l"); 18 json::json_pointer ptr11("/ "); 19 json::json_pointer ptr12("/m~0n"); 20 21 22 std::cout << ptr1.to_string() << '\n' 23 << ptr2.to_string() << '\n' 24 << ptr3.to_string() << '\n' 25 << ptr4.to_string() << '\n' 26 << ptr5.to_string() << '\n' 27 << ptr6.to_string() << '\n' 28 << ptr7.to_string() << '\n' 29 << ptr8.to_string() << '\n' 30 << ptr9.to_string() << '\n' 31 << ptr10.to_string() << '\n' 32 << ptr11.to_string() << '\n' 33 << ptr12.to_string() << std::endl; 34 } nlohmann::json basic_json<> json default JSON class Definition: json.hpp:13933 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 with
      g++ -std=c++11 -Isrc doc/examples/
      json_pointer__to_string.cpp -o
      json_pointer__to_string
Since version 2.0.0 Definition at line 12611 of file json.hpp.