Support Adobe's settings for JSON serialization
Description
Activity
Igal Sapir 29 May 2018 at 00:34
I have implemented the following:
SerializeJSON( myQry, [ "row" ] | "column" | "struct" | true | false );
this.serialization.preserveCaseForStructKey = false | [ true ];
this.serialization.preserveCaseForStructKey = [ false ] | true;
this.serialization.serializeQueryAs = [ "row" ] | "column" | "struct";
I have not implemented this.serialization.structMetaData as it should be implemented with the new function StructSetMetaData (see LDEV-1809) as that function can override the global settings. The documentation at https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-s/serializejson.html (struct value) is inconsistent with the one at https://helpx.adobe.com/coldfusion/cfml-reference/application-cfc-reference/application-variables.html (simple value).
I have not implemented this.customSerializer as it clashes with our current API and TBH I'm not sure what it's supposed to do.
New tickets can/should be opened for the last two items.
Igal Sapir 28 May 2018 at 23:56
To enable case preservation of struct keys at the application level, modify the application.cfc file by setting:
this.serialization.preservecaseforstructkey = trueThe default behavior is true. To switch back to the old behavior, set this value to false.
But according to https://helpx.adobe.com/coldfusion/cfml-reference/application-cfc-reference/application-variables.html the default value is False.
The quoted text above is more consistent with Lucee so I've set it to that until and unless we determine that a change is required.
Igal Sapir 28 May 2018 at 19:45Edited
For Query serialization with a string argument, the following options are available:
default - "row", overridden by this.serialization.serializeQueryAs="struct"
false, "row" - false is implemented, need to add "row" as alias
true, "column" - true is implemented, need to add "column" as alias
"struct" - added in
Patrick Quinn 31 August 2017 at 15:05
Thanks for the heads-up, . I've tagged this for a future sprint, and I see upped the priority to Critical, too.

Sean P. Ford 26 August 2017 at 22:30
This will definitely help me. I'm about to transition a very large app from ACF2016 to Lucee and there are a TON of DATATABLES (datatable.net) in it. The native conversion to an array of structs is exactly what I need.
Now, any chance this same functionality has made it over to remote CFCs? (Where returnFormat=JSON and returnType=struct would return the json formatted array of structs that ACF does)
Details
Details
Assignee
Reporter

Labels
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Seems Adobe has several JSON serialization-related settings that Lucee doesn't have, but I'm unclear on whether we need them.
The first is a series of `this.serialization` settings in `Application.cfc`
Check out the entire section labeled "Serializing structs" on this page:
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-s/serializejson.html
Also, the struct, row, and columns parameters to serializeJSON is documented here
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-s/serializejson.html
They just released a ton of new stuff in 2016 update 2 to tell CF how to serialize structs properly.