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
}