mirror of
https://github.com/nlohmann/json.git
synced 2026-10-03 22:06:59 +01:00
18 lines
380 B
C++
18 lines
380 B
C++
#include <iostream>
|
|
#include <nlohmann/json.hpp>
|
|
|
|
using json = nlohmann::json;
|
|
using ordered_json = nlohmann::ordered_json;
|
|
|
|
int main()
|
|
{
|
|
// create a JSON value
|
|
json j = {{"one", 1}, {"two", 2}, {"three", 3}};
|
|
|
|
// convert to a different basic_json specialization
|
|
ordered_json oj = j.get<ordered_json>();
|
|
|
|
std::cout << j << '\n';
|
|
std::cout << oj << '\n';
|
|
}
|