2
0

parse__array__parser_callback_t.cpp 678 B

123456789101112131415161718192021222324252627282930
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <nlohmann/json.hpp>
  4. using json = nlohmann::json;
  5. int main()
  6. {
  7. // a JSON text
  8. char text[] = R"(
  9. {
  10. "Image": {
  11. "Width": 800,
  12. "Height": 600,
  13. "Title": "View from 15th Floor",
  14. "Thumbnail": {
  15. "Url": "http://www.example.com/image/481989943",
  16. "Height": 125,
  17. "Width": 100
  18. },
  19. "Animated" : false,
  20. "IDs": [116, 943, 234, 38793]
  21. }
  22. }
  23. )";
  24. // parse and serialize JSON
  25. json j_complete = json::parse(text);
  26. std::cout << std::setw(4) << j_complete << "\n\n";
  27. }