title: How to fetch all the nodes and child nodes of JSON object in java?
body: <p>I want to fetch all the nodes of the below JSON object. For example<br>
  result, identification, payment etc.</p>
  
  <pre><code>{
      "result": {
          "identification": {
              "transactionid": "Merchant Assigned ID",
              "uniqueid": "d91ac8ff6e9945b8a125d6e725155fb6",
              "shortid": "0000.0005.6238",
              "customerid": "customerid 12345"
          },
          "payment": {
              "amount": "2400",
              "currency": "EUR",
              "descriptor": "order number"
          },
          "level": 0,
          "code": 0,
          "method": "creditcard",
          "type": "preauthorization",
          "message": "approved",
          "merchant": {
              "key1": "Value1",
              "key0": "Value0"
          }
      },
      "id": 1,
      "jsonrpc": "2.0"
  }
  </code></pre>
  
  <p>I have used the following code:</p>
  
  <pre><code>JSONObject partsData = new JSONObject(returnString);
  Iterator&lt;String&gt; iterator = jsonObject.keys();
  
  while (iterator.hasNext()) {
      String result=iterator.next();
      System.out.println(result);
  }
  </code></pre>
  
  <p>But the result I am getting is:</p>
  
  <pre><code>id
  result
  jsonrpc
  </code></pre>
  
  <p>How do I get all the node names?</p>