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