title: Error parsing data org.json.JSONException: End of input at character 0 of
body: <p>I'm trying to parse JSON data which is coming from <a href="http://dev.virtualearth.net/REST/v1/Traffic/Incidents/40.70000,-74.10000,40.8000,-74.0000?key=AoHoD_fdpQD73-OoTNnnsGzYu5ClXmVNAGr2t-M_wKbR8TWHqKrZR1X6GHI5pzWm" rel="nofollow noreferrer">this url</a>.</p>
  <p>But I am getting these errors:</p>
  <blockquote>
  <p>03-27 16:48:21.019: E/Buffer Error(23717): Error converting result java.lang.NullPointerException</p>
  <p>03-27 16:48:21.059: E/JSON Parser(23717): Error parsing data org.json.JSONException: End of input at character 0 of</p>
  </blockquote>
  <p>Wwhen I debug my code; <code>getJsonFromUrl()</code> method returns <strong>null jobject</strong>. Here is the <em>JSONParser class</em> which I used. What's causing the error?</p>
  <pre><code>public class JSONParser {
  
      static InputStream iStream = null;
      static JSONArray jarray = null;
      static JSONObject jObj= null;
      static String json = &quot;&quot;;
  
      public JSONParser() {
      }
  
  
  
      public JSONObject getJSONFromUrl(String url) {
  
          // Making HTTP request
          DefaultHttpClient httpClient = new DefaultHttpClient();
          HttpPost httpPost = new HttpPost(url);
  
  
  
          try {
              HttpResponse httpResponse = httpClient.execute(httpPost);
              HttpEntity httpEntity = httpResponse.getEntity();
              InputStream is = httpEntity.getContent();
              BufferedReader reader = new BufferedReader(new InputStreamReader(is, &quot;iso-8859-1&quot;), 8);
              StringBuilder sb = new StringBuilder();
              String line = null;
              while ((line = reader.readLine()) != null) {
                  sb.append(line + &quot;\n&quot;);
              }
              iStream.close();
              json = sb.toString();
          } catch (Exception e) {
              Log.e(&quot;Buffer Error&quot;, &quot;Error converting result &quot; + e.toString());
          }
  
          // try parsing the string to a JSON object
          try {
              if (json != null) {
                  jObj = new JSONObject(json);
              } else {
                  jObj = null;
              }
          } catch (JSONException e) {
              Log.e(&quot;JSON Parser&quot;, &quot;Error parsing data &quot; + e.toString());
          }
  
          // return JSON String
          return jObj;
  
      }
  }
  </code></pre>
  <p>I'm making the call for this method from another class using these lines. (url parameter is defined at top)</p>
  <pre><code>  JSONParser jParser = new JSONParser();
    final JSONObject jobject = jParser.getJSONFromUrl(url);
  </code></pre>