title: Get first key and value from JSON object
body: <p>I have JSON returned from my web server in the following form:</p>
  
  <pre><code>{"success":false,"errors":{"username":["Invalid username","Username too short"],"password":["Invalid password"]}}
  </code></pre>
  
  <p>How can I, in Java, parse the JSON to get the <strong>first key</strong> and the <strong>first value of that key</strong>? So in the above case, the output should be:</p>
  
  <pre><code>username
  Invalid username
  </code></pre>
  
  <p>My current code looks like this:</p>
  
  <pre><code>String json =  new String(((TypedByteArray) retrofitError.getResponse().getBody()).getBytes());
  
  try {
      JSONObject obj = new JSONObject(json);
  
      String success = obj.getString("success");
      JSONObject errors = obj.getJSONObject("errors");
  
      // TODO
  
  } catch (JSONException e) {
      e.printStackTrace();
  }
  </code></pre>