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
735 B

  1. #include <json.hpp>
  2. using json = nlohmann::json;
  3. int main()
  4. {
  5. // create the different JSON values with default values
  6. json j_null(json::value_t::null);
  7. json j_boolean(json::value_t::boolean);
  8. json j_number_integer(json::value_t::number_integer);
  9. json j_number_float(json::value_t::number_float);
  10. json j_object(json::value_t::object);
  11. json j_array(json::value_t::array);
  12. json j_string(json::value_t::string);
  13. // serialize the JSON values
  14. std::cout << j_null << '\n';
  15. std::cout << j_boolean << '\n';
  16. std::cout << j_number_integer << '\n';
  17. std::cout << j_number_float << '\n';
  18. std::cout << j_object << '\n';
  19. std::cout << j_array << '\n';
  20. std::cout << j_string << '\n';
  21. }