basic_json__copyassignment.cpp 283 B

123456789101112131415161718
  1. #include <iostream>
  2. #include <nlohmann/json.hpp>
  3. using json = nlohmann::json;
  4. int main()
  5. {
  6. // create JSON values
  7. json a = 23;
  8. json b = 42;
  9. // copy-assign a to b
  10. b = a;
  11. // serialize the JSON arrays
  12. std::cout << a << '\n';
  13. std::cout << b << '\n';
  14. }