blob: 3890551152e06225d69232114f3c0b410f88d2e1 [file] [edit]
#include <iostream>
#include <nlohmann/json_view.hpp>
using nlohmann::ordered_json_document;
int main()
{
// ordered_json_document is basic_json_document<nlohmann::ordered_json>:
// materialize() preserves the insertion (source) order of object keys,
// instead of sorting them like json_document does
ordered_json_document doc = ordered_json_document::parse(R"({"z": 1, "a": 2, "m": 3})");
std::cout << doc.root().materialize().dump() << '\n';
}