title: how to parse nested json array in java
body: <p>I would like to parse netsted json in Java: Below is json string:</p>
  
  <pre><code>[
      {
          "id": 1,
          "empid": "12345",
          "details": {
              "name": "xyz",
              "age": "30",
              "sex": "M",
              "Address": {
                  "Office": "office",
                  "Home": "Home"
              }
          },
          "abcDetails": "asdf",
          "mobile": 123455
      },
      {
          "id": 2,
          "empid": "64848",
          "details": {
              "name": "eryje",
              "age": 3027,
              "sex": "M",
              "Address": {
                  "Office": "office",
                  "Home": "Home"
              }
          },
          "abcDetails": "fhkdl",
          "mobile": 389928
      }
  ]
  </code></pre>
  
  <p>I need <strong>name, age</strong> details from above json, can someone help how to parse these value in java, i tried the below code to get those value - it seems its nested and not sure how to get those value.</p>
  
  <pre><code>        JSONArray jsonarray = new JSONArray(str);
          for (int i = 0; i &lt; jsonarray.length(); i++) {
              JSONObject obj1 = jsonarray.getJSONObject(i);
  
              String name = obj1.getString("name");
              String age = obj1.getString("age");
  
              System.out.println(name);
              System.out.println(age);
          }
  </code></pre>