You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
377 B

  1. #include <json.hpp>
  2. using json = nlohmann::json;
  3. int main()
  4. {
  5. // create an array value
  6. json array = {1, 2, 3, 4, 5};
  7. // get am iterator to one past the last element
  8. json::iterator it = array.end();
  9. // decrement the iterator to point to the last element
  10. --it;
  11. // serialize the element that the iterator points to
  12. std::cout << *it << '\n';
  13. }