]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/nlohmann-json/doc/examples/unflatten.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / nlohmann-json / doc / examples / unflatten.cpp
1 #include <iostream>
2 #include <iomanip>
3 #include <nlohmann/json.hpp>
4
5 using json = nlohmann::json;
6
7 int main()
8 {
9 // create JSON value
10 json j_flattened =
11 {
12 {"/answer/everything", 42},
13 {"/happy", true},
14 {"/list/0", 1},
15 {"/list/1", 0},
16 {"/list/2", 2},
17 {"/name", "Niels"},
18 {"/nothing", nullptr},
19 {"/object/currency", "USD"},
20 {"/object/value", 42.99},
21 {"/pi", 3.141}
22 };
23
24 // call unflatten()
25 std::cout << std::setw(4) << j_flattened.unflatten() << '\n';
26 }