mirror of
https://github.com/nlohmann/json.git
synced 2024-08-21 12:32:27 +02:00
* Add operator<< for json_pointer * Deprecate json_pointer::operator string_t() * Update documentation * Move operator<<(basic_json) example * Add example * Add mkdocs-redirects * Move operator<< and operator>> doc pages out of basic_json/ * Rename JSON pointer operator_string to operator_string_t * Add unit test
20 lines
339 B
C++
20 lines
339 B
C++
#include <iostream>
|
|
#include <nlohmann/json.hpp>
|
|
|
|
using json = nlohmann::json;
|
|
|
|
int main()
|
|
{
|
|
// different JSON Pointers
|
|
json::json_pointer ptr1("/foo/0");
|
|
json::json_pointer ptr2("/a~1b");
|
|
|
|
// implicit conversion to string
|
|
std::string s;
|
|
s += ptr1;
|
|
s += "\n";
|
|
s += ptr2;
|
|
|
|
std::cout << s << std::endl;
|
|
}
|