00001 #include <json.hpp> 00002 00003 using json = nlohmann::json; 00004 00005 int main() 00006 { 00007 // create a JSON value 00008 json value = {{"array", {1, 2, 3, 4}}}; 00009 00010 // create an array_t 00011 json::array_t array = {"Snap", "Crackle", "Pop"}; 00012 00013 // swap the array stored in the JSON value 00014 value["array"].swap(array); 00015 00016 // output the values 00017 std::cout << "value = " << value << '\n'; 00018 std::cout << "array = " << array << '\n'; 00019 }