开发者

Getting Response in the form of json on logcat

开发者 https://www.devze.com 2023-02-20 20:47 出处:网络
{ \"Generalinfor\": { \"type\": \"Response\", \"name\": \"abcde\", \"ver\": \"3.0.0\" }, \"Login\": { \"errorCode\": \"001\",
{
    "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...

0

精彩评论

暂无评论...
验证码 换一张
取 消