1 #include <iostream> 2 #include <nlohmann/json.hpp> 3 4 using json = nlohmann::json; 5 main()6int main() 7 { 8 // create a JSON value 9 json value = { "the good", "the bad", "the ugly" }; 10 11 // create string_t 12 json::string_t string = "the fast"; 13 14 // swap the object stored in the JSON value 15 value[1].swap(string); 16 17 // output the values 18 std::cout << "value = " << value << '\n'; 19 std::cout << "string = " << string << '\n'; 20 } 21