1#include <iostream>
2#include <iomanip>
3#include <nlohmann/json.hpp>
4
5using json = nlohmann::json;
6
7int 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}
27