mirror of
https://github.com/nlohmann/json.git
synced 2025-04-19 13:02:16 +03:00
* 👥 update contributor and sponsor list * 🚧 document BJData format * 🚧 document BJData format * 📝 clarified documentation of [json.exception.parse_error.112] * ✏️ adjust titles * 📝 add more examples * 🚨 adjust warnings for index.md files * 📝 add more examples * 🔥 remove example for deprecated code * 📝 add missing enum entry * 📝 overwork table for binary formats * ✅ add test to create table for binary formats * 📝 fix wording in example * 📝 add more examples * Update iterators.md (#3481) * ✨ add check for overloads to linter #3455 * 👥 update contributor list * 📝 add more examples * 📝 fix documentation * 📝 add more examples * 🎨 fix indentation * 🔥 remove example for destructor * 📝 overwork documentation * Updated BJData documentation, #3464 (#3493) * update bjdata.md for #3464 * Minor edit * Fix URL typo * Add info on demoting ND array to a 1-D optimized array when singleton dimension Co-authored-by: Chaoqi Zhang <prncoprs@163.com> Co-authored-by: Qianqian Fang <fangqq@gmail.com>
35 lines
1.1 KiB
C++
35 lines
1.1 KiB
C++
#include <iostream>
|
|
#include <nlohmann/json.hpp>
|
|
|
|
using json = nlohmann::json;
|
|
|
|
int main()
|
|
{
|
|
// different JSON Pointers
|
|
json::json_pointer ptr1("");
|
|
json::json_pointer ptr2("/foo");
|
|
json::json_pointer ptr3("/foo/0");
|
|
json::json_pointer ptr4("/");
|
|
json::json_pointer ptr5("/a~1b");
|
|
json::json_pointer ptr6("/c%d");
|
|
json::json_pointer ptr7("/e^f");
|
|
json::json_pointer ptr8("/g|h");
|
|
json::json_pointer ptr9("/i\\j");
|
|
json::json_pointer ptr10("/k\"l");
|
|
json::json_pointer ptr11("/ ");
|
|
json::json_pointer ptr12("/m~0n");
|
|
|
|
std::cout << ptr1.to_string() << '\n'
|
|
<< ptr2.to_string() << '\n'
|
|
<< ptr3.to_string() << '\n'
|
|
<< ptr4.to_string() << '\n'
|
|
<< ptr5.to_string() << '\n'
|
|
<< ptr6.to_string() << '\n'
|
|
<< ptr7.to_string() << '\n'
|
|
<< ptr8.to_string() << '\n'
|
|
<< ptr9.to_string() << '\n'
|
|
<< ptr10.to_string() << '\n'
|
|
<< ptr11.to_string() << '\n'
|
|
<< ptr12.to_string() << std::endl;
|
|
}
|