json/docs/examples/basic_json__nullptr_t.cpp

17 lines
298 B
C++
Raw Normal View History

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