title: Java - How to get object value in JSON array?
body: <p>i have a JSON like example below and i'm trying to get some values, for example value of. </p>
  
  <pre><code>results.shipper.id
  
  
  
  {
      "results": [
          {
              "updated": false,
              "notification": false,
              "some_data": {
                  "id": 15989,
                  "pieces": 0,
  
              },
              "shipper": {
                  "updated": false,
                  "notification": false,
                  "id": 1587,
                  "parent": {
                      "updated": false
                  },
  </code></pre>
  
  <p>I'm trying to get value by this way:</p>
  
  <pre><code>    String test = shipmentData.getJSONObject("shipper").getString("id");
  </code></pre>
  
  <p>But it always throws a exception. I think, that exception is caused because of the i am not accessing to the values via "results" array.</p>
  
  <p>How can i easy access to the value what i need. </p>
  
  <p>I tried find some helpers (Gson, fast-json, etc..) but it seems to be a quite complicated for using (i would like to work with JSON tree for direct access to values "on-the-fly" or access to values like to a object, it means.. Object.InnerObject.value ). </p>
  
  <p>So question is how can i do it right?</p>
  
  <p>Thanks for any advice. </p>