json/doc/examples/basic_json__nullptr_t.cpp

17 lines
298 B
C++
Raw Permalink Normal View History

#include <iostream>
#include <nlohmann/json.hpp>
2015-06-20 22:59:33 +00:00
using json = nlohmann::json;
2015-06-20 22:59:33 +00:00
int main()
{
2016-08-31 15:07:35 +00:00
// implicitly create a JSON null value
json j1;
// explicitly create a JSON null value
json j2(nullptr);
2015-06-20 22:59:33 +00:00
// serialize the JSON null value
2016-08-31 15:07:35 +00:00
std::cout << j1 << '\n' << j2 << '\n';
2015-06-20 22:59:33 +00:00
}