Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::string s = "[\n"
- " {\n"
- " \"array\":[\n"
- " 1,\n"
- " 2,\n"
- " 3\n"
- " ],\n"
- " \"bool\":true,\n"
- " \"double\":42.1,\n"
- " \"int\":42,\n"
- " \"map\":{\n"
- " \"key\":\"value\"\n"
- " },\n"
- " \"null\":null,\n"
- " \"string\":\"hello\"\n"
- " }\n"
- "]";
- Array arr;
- arr.emplace_back(Dict{
- {"int"s, 42},
- {"double"s, 42.1},
- {"null"s, nullptr},
- {"string"s, "hello"s},
- {"array"s, Array{1, 2, 3}},
- {"bool"s, true},
- {"map"s, Dict{{"key"s, "value"s}}},
- });
- std::stringstream strm;
- strm << s;
- const auto doc = Load(strm);
- assert(doc.GetRoot() == arr);
- Print(doc, cout);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement