Details
-
Bug
-
Resolution: Fixed
-
Neutral
-
None
-
None
-
-
Empty show more show less
-
Kromeriz 148, Kromeriz 149
-
3
Description
The order of the data items are unpredictable when calling the jsonfn templating functions to serialize the JCR content.
The proposed solution by the client here is to swap out all references of HashMap to LinkedHashMap within the info.magnolia.templating.jsonfn.JsonBuilder class.
In my local testing, I have created a custom set of templating functions by cloning https://git.magnolia-cms.com/projects/FORGE/repos/magnolia-jsonfn/browse/src/main/java/info/magnolia/templating/jsonfn and replacing info.magnolia.templating.jsonfn.JsonBuilder.java and info.magnolia.templating.jsonfn.JsonTemplatingFunctions.java with the custom classes I have attached.
The difference between JsonBuilder and CustomJsonBuilder are the changed references of HashMap to LinkedHashMap. CustomJsonTemplatingFunctions does require the DamTemplatingFunctions object to be passed to the JsonBuilder.