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.

16 lines
323 B

  1. #include <json.hpp>
  2. using json = nlohmann::json;
  3. int main()
  4. {
  5. // create a JSON array
  6. json v = {1, 2, 3, 4};
  7. // insert number 10 before number 3
  8. auto new_pos = v.insert(v.begin() + 2, 10);
  9. // output new array and result of insert call
  10. std::cout << *new_pos << '\n';
  11. std::cout << v << '\n';
  12. }