I am trying to convert following json string to JSONObject in android. But it throws JSONException. I have been digging up my mind for past few hours. Please help.
JSON String :
parseExchangeRate({"query":
{"count":1,"created":"2012-09-07T18:49:32Z","lang":"en-US","results":
{"row":{"rate":"55.395","name":"USD to INR"}}}});
Exception:
Value <jsonobject>parseExchangeRate( of type java.lang.String cannot be converted to JSONObject
Code :
String result = convertStreamToString(instream);
Log.d(TAG, result); //this outputs the above stated string
JSONObject json = new JSONObject(result); // this line thows exception
Thanks in advance.