mirror of
https://github.com/nlohmann/json.git
synced 2026-10-22 14:08:13 +00:00
17 lines
483 B
C++
17 lines
483 B
C++
#include <iostream>
|
|
#include <nlohmann/json_view.hpp>
|
|
|
|
using json_document = nlohmann::json_document;
|
|
|
|
int main()
|
|
{
|
|
std::cout << std::boolalpha;
|
|
|
|
// json_document is basic_json_document<nlohmann::json>: same value types
|
|
// and containers as the ordinary json specialization
|
|
json_document doc = json_document::parse(R"({"pi": 3.14, "numbers": [1, 2, 3]})");
|
|
|
|
std::cout << doc.root().is_object() << '\n';
|
|
std::cout << doc.root().materialize().dump() << '\n';
|
|
}
|