title: Using JSON.Simple with nested objects and arrays
body: <p>I've decided on using JSON.Simple to parse Java in my application, as apposed to GSON or Jackson, because both of them seem over complicated for my needs and appeared to need additional class files to work as intended. I have the following JSON:</p>
  
  <pre><code>{
      "request":{
          "act":"rec_load_all",
          "email":"Redacted",
          "tkn":"Redacted",
          "a":"rec_load_all",
          "z":"Redacted"
      },
      "response":{
          "recs":{
              "has_more":false,
              "count":9,
              "objs":[{
                  "rec_id":"1385442465",
                  "rec_hash":"1825780e334bcd831034bd9ca62",
                  "zone_name":"Redacted",
                  "name":"Redacted",
                  "display_name":"Redacted",
                  "type":"A",
                  "prio":null,
                  "content":"Redacted",
                  "display_content":"Redacted",
                  "ttl":"1",
                  "ttl_ceil":86400,
                  "ssl_id":null,
                  "ssl_status":null,
                  "ssl_expires_on":null,
                  "auto_ttl":1,
                  "service_mode":"1",
                  "props":{
                      "proxiable":1,
                      "cloud_on":1,
                      "cf_open":0,
                      "ssl":0,
                      "expired_ssl":0,
                      "expiring_ssl":0,
                      "pending_ssl":0,
                      "vanity_lock":0
                  }
              }]
          }
      },
      "result":"success",
      "msg":null
  }
  </code></pre>
  
  <p>The <code>objs</code> array lists 9 different items, but I only included one for simplicity. I need to get <code>has_more</code>, <code>count</code>, and the <code>id</code> within <code>objs</code>. I've tried:</p>
  
  <pre><code>JSONParser jsonParser = new JSONParser();
  JSONObject jsonObject = (JSONObject) jsonParser.parse(responseString);
  JSONArray objs = (JSONArray) jsonObject.get("objs");
  Iterator&lt;JSONObject&gt; iterator = objs.iterator();
  while (iterator.hasNext()) {
      JSONObject idObj = (JSONObject) iterator.next();
      String id = (String) idObj.get("rec_id");
      System.out.println(id);
  }
  </code></pre>
  
  <p>But it fires a <code>java.lang.NullPointerException</code> error, so I'm assuming because it's nested under <code>response -&gt; recs -&gt; objs</code> it isn't getting a value. I'm also following a few year old tutorial, so something could have changed since. If you could explain whats wrong and an example of how to fix it, I would greatly appreciate it, I learn by seeing.</p>
  
  <p>EDIT: Full error</p>
  
  <pre><code>Exception in thread "main" java.lang.NullPointerException
      at ddns.Net.getId(Net.java:46)
      at ddns.DDNS.main(DDNS.java:7)
  Java Result: 1
  </code></pre>
  
  <p>ddns.Net.getId(Net.java:46) | <code>Iterator&lt;JSONObject&gt; iterator = objs.iterator();</code>
  ddns.DDNS.main(DDNS.java:7) | <code>Just calls the method</code></p>