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 object =
00009 {
00010 {"the good", "il buono"},
00011 {"the bad", "il cativo"},
00012 {"the ugly", "il brutto"}
00013 };
00014
00015
00016 std::cout << object.at("the ugly") << '\n';
00017
00018
00019 try
00020 {
00021 std::cout << object.at("the fast") << '\n';
00022 }
00023 catch (std::out_of_range)
00024 {
00025 std::cout << "out of range" << '\n';
00026 }
00027 }