json/doc/examples/basic_json__nullptr_t.cpp

17 lines
298 B
C++
Raw Normal View History

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