mirror of
https://github.com/nlohmann/json.git
synced 2024-08-22 13:02:28 +02:00
9b32f72584
As I learned in https://github.com/melpon/wandbox/issues/209, this library is already installed at Wandbox, so we need to adjust the examples to use `#include "json.hpp"` insteas of `#include <json.hpp>`.
18 lines
391 B
C++
18 lines
391 B
C++
#include "json.hpp"
|
|
|
|
using json = nlohmann::json;
|
|
|
|
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';
|
|
}
|