Reputation: 2049
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.
Upvotes: 1
Views: 598
Reputation: 132972
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");
//.....
Upvotes: 3