Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2.  
  3.  
  4. #include <nlohmann/json.hpp>
  5. using json = nlohmann::json;
  6.  
  7.  
  8. int
  9. main( int argc, char *argv[] )
  10. {
  11.     json foo = R"({"key1": "value1"})"_json;
  12.  
  13.    
  14.     std::cerr << "key1:" << foo["key1"] << ", size()=" << foo.size() << "\n";
  15.     std::cerr << "key2:" << foo["key2"] << ", size()=" << foo.size() << "\n";
  16. }
  17.  
  18.  
  19. //
  20. /*
  21. $ g++ nloh.cpp
  22. $ ./a.out
  23. key1:"value1", size()=1
  24. key2:null, size()=2
  25. $
  26. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement