Regression: DeserializeJSON() works in Lucee 5 wi...
# lucee
s
Regression: DeserializeJSON() works in Lucee 5 with an empty string, returns an error in Lucee 6. https://docs.lucee.org/reference/functions/deserializejson.html (Try changing the JSON to an empty string and running it and then changing the selector in the runner on that page to Lucee 6)
a
""
is not valid JSON. It was wrong that it worked in Lucee 5. So this is not a regression, it's a bug fix. A string in JSON needs to actually have the quotes, so to express an empty string as a JSON string, it'd be
'""'
Similarly a non-zero-length string in JSON would be
'"my string"'
Do you see the difference?
s
Yep, sorry, I discovered this wasn't a regression, it was intentional. And it's not valid in Javascript, either, or Adobe CFML
👍 1
a
It's in the RFC (https://datatracker.ietf.org/doc/html/rfc8259) and the slightly more consumable https://www.json.org/json-en.html
s
a
I just had an argument with chatgpt over this (because I do that sort of thing), and had to concede "oh!!! OK yeah I get it"
s
I mean I guess it's technically a "breaking change" but at least it wasn't accidental.
a
ha, I'm even watching / voted for that issue. Musta bitten me at some point. Wish my memory was better
Any bug fix is intrinsically going to be a breaking change. it's implicit.
👍 1
That ticket should not be an "incompatibility", it should just be a "bug". Lucee ain't helping themselves there.
Anyway, thanks for making me read upon JSON strings 😄
😄 1
s
I think it is listed as a breaking change