00001 #include <json.hpp> 00002 00003 using json = nlohmann::json; 00004 00005 int main() 00006 { 00007 // create a JSON value 00008 json value = { {"translation", {{"one", "eins"}, {"two", "zwei"}}} }; 00009 00010 // create an object_t 00011 json::object_t object = {{"cow", "Kuh"}, {"dog", "Hund"}}; 00012 00013 // swap the object stored in the JSON value 00014 value["translation"].swap(object); 00015 00016 // output the values 00017 std::cout << "value = " << value << '\n'; 00018 std::cout << "object = " << object << '\n'; 00019 }