简体   繁体   中英

org.json.JSONException: No value for status Android Parsing

Hello i have an error in my code in json parsing where the error is

org.json.JSONException: No value for status

JSONObject c = new JSONObject();

try {

    if(c.has("status")) {

This is the Json format, i have problem in getting status value.

{
    "id": "7",
    "nome": "dfsdfsdfsdff",
    "email": "and@gmail.com",
    "status": "1"
}

you need to put your response in JSONObject constructor

JSONObject c = new JSONObject(yourResponseString);
//                            ^^^^^^^^^^^

Currently it is empty hence no status or anything else

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM