Reputation: 5134
I get json response in Buffered Reader. Now How to convert buffered-reader string to JSON?
I get the String like
[
{
"email": "[email protected]",
"password": "test@123!",
"role": "monitor",
"code": "0"
}
]
Upvotes: 1
Views: 3063
Reputation: 128428
You can create JSONArray with the response string by using:
JSONArray arrayJSON = new JSONArray(responseString);
And use getJSONObject()
to get JSONObject and use getString()
to get string value from particular JSONObject.
Upvotes: 3
Reputation: 6533
JSONArray aardata = new JSONArray(your buffered reader String):
And For Parse
JSONObject obj = arrdata.getJsonObject(0);
String email = obj.getString('email');
Upvotes: 3