lundi 22 août 2016

I'm getting net.sf.JSONObject can't be cast to java.lang.String Exception

I'm reading the JSONObject as input and i am retrieving the value of key "id" using getString() method of net.sf.json API but i'm curious to know why it is not going in the if block..

INPUT:
    {
    "id" : null
    }

code:

//reading the jsonObject from String
JSONObject jsonObject.fromObject(someString);
String id = jsonObject.getString("id");
if( id == null)
{
        //the control is not going in this if condition
}

Aucun commentaire:

Enregistrer un commentaire