json/docs/examples/basic_json__size_type_basic_json.cpp

19 lines
420 B
C++
Raw Normal View History

#include <iostream>
#include <nlohmann/json.hpp>
2015-06-21 09:44:12 +02:00
using json = nlohmann::json;
2015-06-21 09:44:12 +02:00
int main()
{
// create an array by creating copies of a JSON value
json value = "Hello";
json array_0 = json(0, value);
json array_1 = json(1, value);
json array_5 = json(5, value);
// serialize the JSON arrays
std::cout << array_0 << '\n';
std::cout << array_1 << '\n';
std::cout << array_5 << '\n';
}