title: Android - Getting value from the JSON object
body: <p>I have this json</p>
  
  <pre><code>{
      "results": [
          {
              "user": {
                  "gender": "male",
                  "name": {
                      "title": "mr",
                      "first": "herbert",
                      "last": "davidson"
                  },
                  "location": {
                      "street": "9763 fincher rd",
                      "city": "melbourne",
                      "state": "new south wales",
                      "zip": 26278
                  },
                  "email": "herbert.davidson@example.com",
                  "username": "lazyelephant581",
                  "password": "abgrtyu",
                  "salt": "O8ZbSsUL",
                  "md5": "7575bd959be09bc6d510a6a91750ce40",
                  "sha1": "0db99de8402e1defbd7935dbd602d99329698d4d",
                  "sha256": "c283d262115f90b729bb555db3dbecc8d27eebed513d7f01da799dec9e9d3269",
                  "registered": 1275070071,
                  "dob": 122409280,
                  "phone": "05-5742-3228",
                  "cell": "0481-652-548",
                  "TFN": "973720989",
                  "picture": {
                      "large": "https://randomuser.me/api/portraits/men/24.jpg",
                      "medium": "https://randomuser.me/api/portraits/med/men/24.jpg",
                      "thumbnail": "https://randomuser.me/api/portraits/thumb/men/24.jpg"
                  }
              }
          }
      ],
      "nationality": "AU",
      "seed": "0a69317ece7072e000",
      "version": "0.7"
  }
  </code></pre>
  
  <p>and im doing this:(result is the json returned from the service)</p>
  
  <pre><code>try{
      JSONObject jsonResponse = new JSONObject(result);
      JSONObject jo = jsonResponse.getJSONObject("user");
      String nome = jo.getString("username"); 
  }catch(Exception e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>but gives me this error </p>
  
  <p>org.json.JSONException: No value for username</p>
  
  <p>What im doing wrong? I tryed to do a JSONArray, tryed to get the jsonobject from another jsonobject, but giver an error that cannot convert jsonobject to a jsonarray.</p>
  
  <p>regards!</p>
  
  <p>Rafael</p>