I have a json where I want its values down in a map, unless that value is NULL, if it is I just want an empty string instead.
I've tried a few different view of telling what the value I get out of the json is, but none of them seems to be able to tell the value is null.
if (!isNull(json.get("id"))) {
orderDataMap.put("id", json.get("id"));
} else {
orderDataMap.put("id", "");
}
if (!isNull(json.get("sr"))) {
orderDataMap.put("sr", json.get("sr"));
} else {
orderDataMap.put("sr", "");
}
if (!isNull(json.get("systemOrderId"))) {
orderDataMap.put("systemOrderId", json.get("systemOrderId"));
} else {
orderDataMap.put("systemOrderId", "");
}
in the if statement I've also tried using json.get("id") != NULL
as well as json.get("id").equals(null)
Here's how it looks while debugging: