Getting Response in the form of json on logcat
{
"Generalinfor": {
"type": "Response",
"name": "abcde",
"ver": "3.0.0"
},
"Login": {
"errorCode": "001",
"errorMsg": "Login Failed - Missing of Password",
"userID": "0",
"versionAvail": "",
"versionDownloadMsg": "can't login "
}
}
I am getting response in json
format on logcat
from my web server.N开发者_Go百科ow i wanted to convert it into string and to displayed this image on emulator. How can I accomplish this?
Please guide me with any tips or sample code possible.
import org.json.JSONObject;
JSONObject jObject = new JSONObject(yourJsonString);
http://www.json.org/javadoc/org/json/JSONObject.html
String type = (String) jObject.get("type"); // would return your type 'Response'
http://www.json.org/javadoc/org/json/JSONObject.html#get(java.lang.String)
etc...
精彩评论