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.

19 lines
409 B

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