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