basic_json__nullptr_t.cpp 298 B

12345678910111213141516
  1. #include <iostream>
  2. #include <nlohmann/json.hpp>
  3. using json = nlohmann::json;
  4. int main()
  5. {
  6. // implicitly create a JSON null value
  7. json j1;
  8. // explicitly create a JSON null value
  9. json j2(nullptr);
  10. // serialize the JSON null value
  11. std::cout << j1 << '\n' << j2 << '\n';
  12. }