]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | #include <iostream> |
2 | #include <nlohmann/json.hpp> | |
3 | ||
4 | using json = nlohmann::json; | |
5 | ||
6 | int main() | |
7 | { | |
8 | // create a JSON object | |
9 | const json object = | |
10 | { | |
11 | {"one", 1}, {"two", 2}, {"three", 2.9} | |
12 | }; | |
13 | ||
14 | // output element with key "two" | |
15 | std::cout << object["two"] << '\n'; | |
16 | } |