Uploaded image for project: 'JSON Templating Functions'
  1. JSON Templating Functions
  2. JSONFN-3

Ordering of Data Items with jsonfn Functions are Unpredictable

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Neutral
    • 1.0.8
    • None
    • None
    • 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.

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              ajuran Antonín Juran
              jnodarse Julian Nodarse
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR
                  Task DoD