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.

19 lines
444 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. // create a JSON array to copy values from
  8. json v2 = {"one", "two", "three", "four"};
  9. // insert range from v2 before the end of array v
  10. auto new_pos = v.insert(v.end(), v2.begin(), v2.end());
  11. // output new array and result of insert call
  12. std::cout << *new_pos << '\n';
  13. std::cout << v << '\n';
  14. }