Advertisement
cepxuozab

LoadMinified

Sep 7th, 2023 (edited)
1,306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. using namespace std;
  2. void MinifiedLoad() {
  3.     std::string s = "[{\"array\":[1,2,3],\"bool\":true,\"double\":42.1,\"int\":42,\"map\":{\"key\":\"value\",\"bool_key\":false},\"null\":null,\"string\":\"hello\"}]";
  4.     Array arr;
  5.     arr.emplace_back(Dict{
  6.         {"int"s, 42},
  7.         {"double"s, 42.1},
  8.         {"null"s, nullptr},
  9.         {"string"s, "hello"s},
  10.         {"array"s, Array{1, 2, 3}},
  11.         {"bool"s, true},
  12.         {"map"s, Dict{{"key"s, "value"s}, {"bool_key"s, false}}},
  13.         });
  14.     std::stringstream strm;
  15.     strm << s;
  16.     const auto doc = Load(strm);
  17.    // assert(doc.GetRoot() == arr);
  18.     Print(doc, cout);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement