Java - How to deserialize a JSON array with nested objects and lists?
<p>How to deserialize a JSON String that contains lists of objects within other objects? I found explanations for simple deserialization, but I can't extrapolate much from them, as they're all a little bit off. As an example(POJOs ommited), for</p>

<pre><code>String json = "[ {
  "id" : 33147,
  "name" : "Refinancing",
  "photos" : [ {
    "name" : "347.png",
    "url" : "/loans/568/photos/092"
  } ],
  "username" : "zach1985"
} , {
  "id" : 7693,
  "name" : "Stuff",
  "photos" : [ {
    "name" : "newpic1.png",
    "url" : "/loans/123446/photos/890"
  } ],
  "username" : "sengaia"
} ]";

ArrayList&lt;Ad&gt; ads = new ArrayList&lt;&gt;;

deserialize(json, ads);

System.out.println(ads.get(1).getName());
System.out.println(ads.get(0).getPhotos().get(0).getName());
</code></pre>

<p>The outputs would be "Stuff" and "347". How would then the deserialize() method need to be implemented?</p>