Есть много причин, по которым это может не работать, одна из них заключается в том, что фактически это inputStream, который возвращается getContent, вот фрагмент рабочего кода из моего приложения
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
...
private static String getInputStreamAsString(Context ctxt, InputStream is)
{
byte[] sBuffer = new byte[512];
ByteArrayOutputStream content = new ByteArrayOutputStream();
// Read response into a buffered stream
int readBytes = 0;
try
{
while ((readBytes = is.read(sBuffer)) != -1)
{
content.write(sBuffer, 0, readBytes);
}
}
catch (IOException e)
{
Util.e(ctxt, TAG, Util.fmt(e));
}
return new String(content.toByteArray());
}
public static test() {
HttpClient client = DefaultHttpClient()
HttpGet request = new HttpGet(url);
HttpResponse response = client.execute(request);;
StatusLine status = response.getStatusLine();
String str = getInputStreamAsString(ctxt, response.getEntity().getContent());
JSONObject json = new JSONObject(str);
}
...