You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
343 B

  1. #include <json.hpp>
  2. using json = nlohmann::json;
  3. int main()
  4. {
  5. // create two JSON values
  6. json j1 = {1, 2, 3, 4, 5};
  7. json j2 = {{"pi", 3.141592653589793}, {"e", 2.718281828459045}};
  8. // swap the values
  9. j1.swap(j2);
  10. // output the values
  11. std::cout << "j1 = " << j1 << '\n';
  12. std::cout << "j2 = " << j2 << '\n';
  13. }