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.

24 lines
411 B

  1. #include <json.hpp>
  2. using json = nlohmann::json;
  3. int main()
  4. {
  5. // create JSON values
  6. json array = {1, 2, 3, 4, 5};
  7. json null;
  8. // print values
  9. std::cout << array << '\n';
  10. std::cout << null << '\n';
  11. // add values
  12. array.push_back(6);
  13. array += 7;
  14. null += "first";
  15. null += "second";
  16. // print values
  17. std::cout << array << '\n';
  18. std::cout << null << '\n';
  19. }