This commit is contained in:
nlohmann committed 2026-10-12 07:35:31 +00:00
1 parent 79119509a9
commit 22fba27145
555 files changed
+17342 -1394

No files matched your search

+24 -2
View File
@@ -53,13 +53,35 @@ a new JSON pointer is built from a copy of `lhs`.
The example shows the usage of `operator/`.
```cpp
--8<-- "examples/json_pointer__operator_add_binary.cpp"
#include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON pointer
json::json_pointer ptr("/foo");
// append a JSON Pointer
std::cout << "\"" << ptr / json::json_pointer("/bar/baz") << "\"\n";
// append a string
std::cout << "\"" << ptr / "fob" << "\"\n";
// append an array index
std::cout << "\"" << ptr / 42 << "\"" << std::endl;
}
```
Output:
```json
--8<-- "examples/json_pointer__operator_add_binary.output"
"/foo/bar/baz"
"/foo/fob"
"/foo/42"
```
## See also