title: Value 207 at userid of type java.lang.Integer cannot be converted to JSONObject
body: <p>I have an problem with putting <code>integer</code> in <code>JSONObject</code>. I have a userid of type <code>integer</code> in the web service. The server returns me json string:</p>
  
  <pre><code>[{"userid":207,
    "name" :"Azan",
    "email":"az@gmail.com",
    "password":"az123456",
    "created_at":"11-Oct-2013",
    "success" : 1
    }] 
  </code></pre>
  
  <p>The problem is that I have to parse userid in <code>JSONObject</code>, but <code>JSONObject</code> takes only Strings, not integers. It gives me error like this:</p>
  
  <pre><code>10-10 08:44:21.872: W/System.err(5706): org.json.JSONException: Value 207 at userid of  type java.lang.Integer cannot be converted to JSONObject
  </code></pre>
  
  <p>The code for <code>JSONParser</code> is:</p>
  
  <pre><code> @SuppressLint("NewApi")
  public class JSONParser {
  
      static InputStream is = null;
      static JSONObject jObj = null;
      static String json = "";
  
  
      private static String KEY_SUCCESS = "success";
      private static String KEY_UID = "uid";
      private static String KEY_NAME = "name";
      private static String KEY_EMAIL = "email";
      private static String KEY_PASSWORD = "password";
      private static String KEY_CREATED_AT = "created_at";
      // constructor
      public JSONParser() {
  
      }
  
  
      public JSONObject getJSONFromUrl(String url, List&lt;NameValuePair&gt; params) {
  
          // Making HTTP request
          try {
              // defaultHttpClient
              DefaultHttpClient httpClient = new DefaultHttpClient();
              HttpPost httpPost = new HttpPost(url);
              httpPost.setEntity(new UrlEncodedFormEntity(params));
  
              HttpResponse httpResponse = httpClient.execute(httpPost);
              HttpEntity httpEntity = httpResponse.getEntity();
              is = httpEntity.getContent();
  
          } catch (UnsupportedEncodingException e) {
              e.printStackTrace();
          } catch (ClientProtocolException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          try {
              BufferedReader reader = new BufferedReader(new InputStreamReader(
                      is, "iso-8859-1"), 8);
              StringBuilder sb = new StringBuilder();
              String line = null;
              while ((line = reader.readLine()) != null) {
                  sb.append(line + "n");
              }
              is.close();
              json = sb.toString();
              Log.e("JSON", json);
          } catch (Exception e) {
              Log.e("Buffer Error", "Error converting result " + e.toString());
          }
  
          // try parse the string to a JSON object
          try {
            jObj  = new JSONArray(json).getJSONObject(0);
  
          } catch (JSONException e) {
              Log.e("JSON Parser", "Error parsing data " + e.toString());
          }
  
          StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
          StrictMode.setThreadPolicy(policy);
          // return JSON String
          return jObj;
  
      }
  }
  </code></pre>
  
  <p>Any suggestion how to solve the problem? </p>