{
"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 "
}
}
我正在从我的网络服务器json
获得logcat
格式的响应。现在我想将其转换为字符串并在模拟器上显示此图像。我怎么能做到这一点?
请向我提供任何可能的提示或示例代码。
答案 0 :(得分:2)
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)
等...