I am having following json
{"signature": null, "state": "eyJjc3OiIifQ", "tokenId": null, "error": "EXCEPTION_REQUEST_CANCELLED"}
from jsonObject of JSONObject jsonObject = new JSONObject(authMeta);
I tried checking
if(jsonObject.get("signature") == null) {} else {}
condition IF failed and code went to else block. tried another method
if(jsonObject.get("signature").toString().isEmpty())
Above also failed.
if(jsonObject.get("signature").equals(null))
Worked.
Following code worked.
jsonObject.isNull("signature")
I checked inside isNull Method, i found following.
public boolean isNull(String key) {
return JSONObject.NULL.equals(this.opt(key));
}
Unable to understand why null is different ?