title: java - the best way to write multiple lists back to back to a single JsonArray
body: <p>My question is what's the best way to convert multiple lists back to back into a single JsonArray. The lists are coming on the fly, so I don't want to or I can't have all the lists(list1 - listn) merged in a big list, then use Jackson to write the merged list to a JsonArray. </p>
  
  <p>Convert</p>
  
  <pre><code>ArrayList&lt;Event&gt; list1 = new ArrayList&lt;Event&gt;();
      list1.add(new Event("a1","a2"));
      list1.add(new Event("b1","b2"));
  
  ArrayList&lt;Event&gt; list2 = new ArrayList&lt;Event&gt;();
      list2.add(new Event("c1","c2"));
      list2.add(new Event("d1","d2"));
  ......
  ......listn 
  </code></pre>
  
  <p>To a single jsonArray:</p>
  
  <pre><code>[
  {"field1":"a1", "field2":"a2"},
  {"field1":"b1", "field2":"b2"},
  {"field1":"c1", "field2":"c2"},
  {"field1":"d1", "field2":"d2"},
  ......
  {"field1":"n1", "field2":"n2"}
  ]
  </code></pre>