davequested
06/11/2023, 10:57 PMlocal.body = {};
local.body.amount = 2000;
writedump(serializeJSON(local.body));abort;
Produces:
{"AMOUNT":2000}
It should be lowercase for AMOUNT. In ACF2016, it correctly outputs:
{"amount":2000}carehart
06/12/2023, 3:09 AMwritedump(getapplicationmetadata().SERIALIZATION);
Third, you refer to using the local scope but don't show this code running in a function/udf/method. Can you confirm that's what you're doing?
Finally, I put all this together into a 2-file app at cffiddle.org, specifically https://cffiddle.org/app/576ece54-457b-4196-8182-e491f6a84781. But folks need to login there (using a google account) to see such code. So I have also zipped up the sample code, and though I can't see a way to attach that 2-file zip here, I can offer this dropbox link to it.
Let's see how things go for you, with that or with your reply to the question above. If it does still happen for you wit this code, maybe identify more about your cf2023 setup, so we can find how it differs from where the code does work.carehart
06/12/2023, 3:50 AMcarehart
06/12/2023, 3:52 AMdavequested
06/12/2023, 3:53 AMdavequested
06/12/2023, 4:04 AM<cfcomponent output="false">
<cffunction name="test" output="false" access="public">
<cfscript>
local.body = {};
local.body.amount = 2000;
writedump(local.body);abort;
</cfscript>
</cffunction>
</cfcomponent>
davequested
06/12/2023, 4:05 AMRodney
06/12/2023, 12:03 PM_this_.serialization.preserveCaseForStructKey _=_
_true_;
in the Application.cfc?carehart
06/12/2023, 2:06 PMDave Merrill
06/12/2023, 2:09 PMlocal.body.amount = 2000
to result in the key AMOUNT, serialized or not.
If you want the key to be "amount", you need to create it with bracket notation, like local.body["amount"]
. (That's assuming you don't care about the case of the body key; if you do, it needs bracket notation too.)Mark Takata (Adobe)
06/12/2023, 2:50 PMcarehart
06/12/2023, 3:06 PMcarehart
06/12/2023, 3:08 PMMark Takata (Adobe)
06/12/2023, 3:10 PMcarehart
06/12/2023, 3:53 PMlocal.body=structnew("casesensitive")
, then the code WOULD work. That's indeed a change in behavior in cf2023 (it is not needed in 2021), but for now perhaps it could be a work-around for you, and a clue for AdobeDave Merrill
06/12/2023, 3:57 PMcarehart
06/12/2023, 4:05 PMdavequested
06/12/2023, 7:04 PM