1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-16 18:41:53 +03:00

Adjust JSON Pointer examples (#3622)

* 📝 adjust JSON Pointer examples

* 👷 add test for documentation

* 📝 note platform-dependent output on some examples
This commit is contained in:
Niels Lohmann
2022-07-29 14:28:37 +02:00
committed by GitHub
parent 6576c3f776
commit d1d79b930d
18 changed files with 86 additions and 56 deletions

View File

@ -7,17 +7,17 @@ int main()
{
// create a JSON pointer
json::json_pointer ptr("/foo");
std::cout << ptr << '\n';
std::cout << "\"" << ptr << "\"\n";
// append a JSON Pointer
ptr /= json::json_pointer("/bar/baz");
std::cout << ptr << '\n';
std::cout << "\"" << ptr << "\"\n";
// append a string
ptr /= "fob";
std::cout << ptr << '\n';
std::cout << "\"" << ptr << "\"\n";
// append an array index
ptr /= 42;
std::cout << ptr << std::endl;
std::cout << "\"" << ptr << "\"" << std::endl;
}