code: public long getLong(String key) throws JSONException {
      Object o = get(key);
      try {
        return o instanceof Number ? ((Number) o).longValue() : Long.parseLong((String) o);
      } catch (Exception e) {
        throw new JSONException("JSONObject[" + quote(key) + "] is not a long.");
      }
    }
docs: Get the long value associated with a key.
  
  @param key
  A key string.
  @return The long value.
  @throws JSONException
  if the key is not found or if the value cannot be converted to a long.