title: get key name & key value from json
body: <p>I'm totally new to java.  How do I get the key name &amp; key value of this jsonobject &amp; pass it to my increment method?</p>
  
  <pre><code>args = {'property_name':1}
  
  
  private boolean handlePeopleIncrement(JSONArray args, final CallbackContext cbCtx) {
  
      JSONObject json_array = args.optJSONObject(0);
  
      mixpanel.getPeople().increment(key_name, key_value);
      cbCtx.success();
      return true;
  }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Now I'm getting the error:</p>
  
  <pre><code>Object cannot be converted to Number  
  Number value = json_array.get(key);
  </code></pre>
  
  <p>-</p>
  
  <pre><code>private boolean handlePeopleIncrement(JSONArray args, final CallbackContext cbCtx) {
       JSONObject json_array = args.optJSONObject(0);
  
      Iterator&lt;?&gt; keys = json_array.keys();
  
      while( keys.hasNext() ) {
          String key = (String) keys.next();
          Number value = json_array.get(key);
         // System.out.println("Key: " + key);
         // System.out.println("Value: " + json_array.get(key));
      }
  
      mixpanel.getPeople().increment(key, value);
      cbCtx.success();
      return true;
  }
  </code></pre>