I'm setting up ColdFusion 2018 (with Update 5) and am having an issue - it seems that "Enable Null Support" option in CF Admin does nothing.
I have some API results (from a 3rd party api) that can return null values - eg; json
{
"FirstName": "Fred",
"LastName": null,
"Email": "[email protected]"
}
When I deserializeJson( theResult )
and cfdump
the struct, it has "undefined" as the value for LastName. In ColdFusion 9 (which I'm porting over to CF2018), in the example given above the value for LastName shows as "null" when doing a cfdump. My issue is that in CF2018 when I try and access this variable it throws an error
Variable LastName is undefined
It doesn't seem to make a difference if you check the box for Enable Null Support in the CF Admin or not. I've tried selecting it, un-selecting it, even restarting CF after each update.
Is this a bug? I'm using CF2018 with Update 5 (version 2018.0.05.315699). Any ideas?
"Before the ColdFusion 2018 the null value from database / JSON becomes empty string. So we couldn't differentiate NULL vs EMPTY value scenario. To provide support for null-based implementation, new version introduce null as part of language changes in ColdFusion 2018.
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-c-d/DeserializeJSON.html Since ColdFusion 10, JSON null values become undefined.
Enable Null Support in ColdFusion 2018 is different and it's nothing to do with the null values in the JSON data handling.
Only the behavior of isNull and isDefined functions will vary with the above setting.
The isNull and isDefined functions return true for a variable with null value. Earlier, the output of isNull function is reverse of the isDefined function output, but now it checks for a variable with value null."