title: Java and REST web service - GET method returns JSONObject["....."] is not a JSONObject
body: <p>I am trying to get response in JAVA from REST web service.</p>
  
  <p>Using HTTP Request tool JSON structure is returned properly.
  This is the JSON response which can be seen in browser's add-on tool:</p>
  
  <pre><code>{
      "QueryMXASSETResponse": {
          "rsStart": 0,
          "rsCount": 1,
          "MXASSETSet": {
              "ASSET": [
                  {
                      "Attributes": {
                          "ASSETID": {
                              "content": 123
                          },
                          "ASSETNUM": {
                              "content": "SM-A-3002"
                          },
                          "DESCRIPTION": {
                              "content": "restint"
                          }
                      }
  
                  }
              ]
          }
      }
  }
  </code></pre>
  
  <p>And this is my code in MAIN method in Java App (I want to get DESCRIPTION value)</p>
  
  <pre><code>String response = httpGet("http://192.168.150.18:9080/maxrest/rest/os/mxasset/?assetid=~eq~123");
      System.out.println(response+"\n");             
      //Parsing JSON response
      JSONObject jsonObj = new JSONObject(response);
      if (jsonObj.has("QueryMXASSETResponse")){
          JSONObject jsonObj2 = jsonObj.getJSONObject("QueryMXASSETResponse");
          JSONObject jsonObj3 = jsonObj2.getJSONObject("MXASSETSet");
          JSONObject jsonObj4 = jsonObj3.getJSONObject("ASSET");
          JSONObject jsonObj5 = jsonObj4.getJSONObject("Attributes");         
          JSONObject jsonObj6= jsonObj5.getJSONObject("DESCRIPTION");
          System.out.println("Description is: "+jsonObj6.getString("content"));
  
      }
  </code></pre>
  
  <p>Error returned is for the jsonObj4 which says it is not JSONObject although you can see in response above that it is. Why I am gettin exception? Can you please help? Thanks</p>
  
  <pre><code>Exception in thread "main" org.json.JSONException: JSONObject["ASSET"] is not a JSONObject.
      at org.json.JSONObject.getJSONObject(JSONObject.java:557)
      at com.getAsset.GETAssets.main(GETAssets.java:91)
  </code></pre>