Go to the documentation of this file.00001 #include <json.hpp>
00002
00003 using json = nlohmann::json;
00004
00005 int main()
00006 {
00007
00008 json j =
00009 {
00010 {"number", 1}, {"string", "foo"}, {"array", {1, 2}}
00011 };
00012
00013
00014
00015
00016 std::cout << j.at("/number"_json_pointer) << '\n';
00017
00018 std::cout << j.at("/string"_json_pointer) << '\n';
00019
00020 std::cout << j.at("/array"_json_pointer) << '\n';
00021
00022 std::cout << j.at("/array/1"_json_pointer) << '\n';
00023
00024
00025
00026
00027 j.at("/string"_json_pointer) = "bar";
00028
00029 std::cout << j["string"] << '\n';
00030
00031
00032 j.at("/array/1"_json_pointer) = 21;
00033
00034 std::cout << j["array"] << '\n';
00035 }