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.

27 lines
876 B

  1. #include <json.hpp>
  2. using json = nlohmann::json;
  3. int main()
  4. {
  5. // create JSON values
  6. json j_null;
  7. json j_boolean = true;
  8. json j_number_integer = 17;
  9. json j_number_float = 23.42;
  10. json j_number_unsigned_integer = 12345678987654321u;
  11. json j_object = {{"one", 1}, {"two", 2}};
  12. json j_array = {1, 2, 4, 8, 16};
  13. json j_string = "Hello, world";
  14. // call is_structured()
  15. std::cout << std::boolalpha;
  16. std::cout << j_null.is_structured() << '\n';
  17. std::cout << j_boolean.is_structured() << '\n';
  18. std::cout << j_number_integer.is_structured() << '\n';
  19. std::cout << j_number_unsigned_integer.is_structured() << '\n';
  20. std::cout << j_number_float.is_structured() << '\n';
  21. std::cout << j_object.is_structured() << '\n';
  22. std::cout << j_array.is_structured() << '\n';
  23. std::cout << j_string.is_structured() << '\n';
  24. }