I want to parse this JSON String :
{
lhs: "1 British pound",
rhs: "1.6152 U.S. dollars",
error: "",
icc: true
}
but JSONArray returns null value.
I want to parse this JSON String :
{
lhs: "1 British pound",
rhs: "1.6152 U.S. dollars",
error: "",
icc: true
}
but JSONArray returns null value.
current json string contain an jsonObject instead of JsonArray so parse it as :
// Convert String to Json Object
JSONObject jsonObject = new JSONObject("Pass_Your_Json_String");
// get lhs
String str_lhs=jsonObject.getString("lhs");
// get rhs
String str_rhs=jsonObject.getString("rhs");
//.....
[] and JSONObject will be in {}.doInBackground change it to return an ArrayList list of parsed values to onPostExecute and remove runOnUiThread beuase we can access UI from onPostExecute without using runOnUiThread