title: Mapping JSON to arrays/objects in Java - Android
body: <p>I have a web system that returns a json string with the data that I need in an Android App. The string is below:</p>
  
  <pre><code>[
      {"id":1,
      "title":"Remove ViRuSeS",
      "tagline":"Remove ViRuSeS",
      "body":"Body",
      "image":"index.jpg",
      "steps":[
              {"id":2,
              "title":"Step 1",
              "body":"Download Things!",
              "position":1}
              ]
      }
  ]
  </code></pre>
  
  <p>It should return an array of objects, with one of the object's items also being an array of items.</p>
  
  <p>I am familiar with gson and have gotten this working in the past, but I always had to simplify my data down to just an object, which makes me end up have to make multiple calls to get the data.</p>
  
  <p>Is there a good way to do this without having to map all of the possible values back into classes?</p>
  
  <p>My last attempt was to just try to get something simple out of this and am getting a <code>NullPointerException</code> on the second of these lines:</p>
  
  <pre><code>userDet = new JSONObject(string);
  JSONArray userDetJson = userDet.getJSONArray("Steps");
  </code></pre>