Is there a setting I am missing the the control panel that keeps structure case with the toScript function? I have already checked the box> Language/Compiler>Key Case.
And that works for a coldfusion structure, but when I use toScript(), it turns everything lowercase.
Don’t forget to tell us about your stack!
OS: Rocky Linux 9
Java Version: OpenJDK 21.0.6
Tomcat Version: Tomcat 9.0.102
Lucee Version: Lucee 6.2.0.321
seems to be hardwired to lowercase…
but I’m seeing the same result in ACF?
Interesting. I come from OpenBlueDragon (OpenBD) and it does not do that.
Definitely worth adding an extra parameter to Preserve case etc.
It’s too late to change the behavior given how case sensitive JavaScript is and backwards compatibility, guess everyone else just consumed what ever was spat out!
Please file an issue, let’s consider it an enhancement
Anything else you’re missing in Lucee from open blue dragon?
Openbluedragon had an excellent csvread function and a cron.d plugin. I have not gotten to far in my Lucee tinkering, but those 2 things I definitely miss. The git repo is still out there, I just do not know how to extract the code from them and move them to Lucee. I would also find the toScript function and push it into Lucee as well.
However, I will file an enhancement request for the time being.
I prefer the elegance of serializeJSON()
which also maintains key case:
s = {"mixedCase": "foo"};
dump(toScript(s, "s"));
// s=new Object();s["mixedcase"]="foo";
dump("s = #serializeJson(s)#");
// s = {"mixedCase":"foo"}
1 Like