Has anyone ran into this serialization bug with CF...
# cfml-general
j
Has anyone ran into this serialization bug with CF2023? > https://tracker.adobe.com/#/view/CF-4218021 All our json responses are now uppercase, regardless of this being set in code 'this.serialization.preserveCaseForStructKey=true', or via the administrator settings. This works fine in CF2018/2021. The comment on this tracker is rather confusing.
t
I have this one that is similar, but applies at least as low as CF2016. https://tracker.adobe.com/#/view/CF-4212705
pre-compiled code ignores the application.cfc setting. I haven't tried on CF2023 yet, so I don't know if it's broken on non-pre-compiled code.
I've been gradually refactoring to use quoted struct keys instead, which avoids this issue entirely.
j
There's multiple ways in CF to make case sensitive structs, quoted being one of them. Or the new StructNew('casesensitive'), as well as setMedataData, etc. But no, this isn't compiled and really the only change is bumping up the engine in CommandBox to 2023.
m
DO NOT USE casesensitive option in the StructNew function: structNew("casesensitive") Especially when passing the structure via a component. I ran into several issues. Best way to keep the case is to quote the keys when defining them in the structure.
mystruct = {'CaseSensitiveKey' : 'value'}
myupperStruct = {alluppercase : 'value'}
👍🏻 1
@Jeff - I ran into all kinds of downstream issues using StructNew('casesensitive'), as well as setMedataData They seem to work fine until you pass them into and out of components.
j
Thanks, I've never actually used it yet, but I have seen it in the documentation. I guess to get back to the original question, its why the application setting
this.serialization.preserveCaseForStructKey
isnt working as it did in previous versions.
☝🏻 2