begin.cpp 330 B

12345678910111213141516
  1. #include <iostream>
  2. #include <nlohmann/json.hpp>
  3. using json = nlohmann::json;
  4. int main()
  5. {
  6. // create an array value
  7. json array = {1, 2, 3, 4, 5};
  8. // get an iterator to the first element
  9. json::iterator it = array.begin();
  10. // serialize the element that the iterator points to
  11. std::cout << *it << '\n';
  12. }