• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  #include <iostream>
2  #include <nlohmann/json.hpp>
3  
4  using json = nlohmann::json;
5  
main()6  int main()
7  {
8      // create several JSON values
9      json array = {1, 2, 3};
10      json object = {{"A", "a"}, {"B", "b"}};
11      json number = 17;
12      json string = "foo";
13      json null;
14  
15      // output values and comparisons
16      std::cout << std::boolalpha;
17      std::cout << array << " == nullptr " << (array == nullptr) << '\n';
18      std::cout << object << " == nullptr " << (object == nullptr) << '\n';
19      std::cout << number << " == nullptr " << (number == nullptr) << '\n';
20      std::cout << string << " == nullptr " << (string == nullptr) << '\n';
21      std::cout << null << " == nullptr " << (null == nullptr) << '\n';
22  }
23