Issues

Select view

Select search mode

 

SerializeJSON: add an optional keyCase parameter

Won't Do

Description

As outlined in https://dev.lucee.org/t/serializejson-some-optional-parameters/10636.

To give more control over the case of the JSON keys, I suggest adding an optional parameter:
keyCase: ‘preserve’ | ‘upper’ | ‘lower’

If missing, revert to the server settings as now: ‘preserve’ | ‘upper’

Opinion / rationale: I know you can manage the key casing and format when you create the structs in the first place. In my mind, however, the serialization is a concern that the originating code should not have to worry about. eg if you need lowercase keys because the requesting client needs it that way, this should be the concern of the serializer, not the business logic. This is especially useful when migrating legacy cfml code bases that might now need a json api attached. IMO.

Thanks,
Murray

Details

Assignee

Reporter

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

Priority

Created 12 July 2022 at 22:12
Updated 5 February 2025 at 12:29
Resolved 5 February 2025 at 12:29

Activity

Show:

Zac Spitzer5 February 2025 at 12:28

Rather than overload the existing function with more arguments (alas, the method signatures already differ from ACF), I reckon that if we add support for useCustomSerializer instead that might help achieve your goal with this proposal

Flag notifications