function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Arun PradhanArun Pradhan 

Template engine to generate XML/JSON based on changing data

Is there any Template Engine like FreeMaker(in Java) which can be used to generate XML or JSON based on Changing data? I am looking for this feature so that I dont have to hardcode the XML structure in my Apex code, instead I will be creating a template and the engine will be able to take the required dataMap as an input along with the template (Static Resource) and will create the XML dynamically. This will enable me to create XMLs without any further coding even if I have any change in the XML template/structure.
Anup JadhavAnup Jadhav
I don't think there is a pre-built engine out there that'll allow you to do this. You'd have to build a be-spoke solution. However, you can choose to open-source it. ;-)

You can look at this article as a starting point - https://developer.salesforce.com/page/Getting_Started_with_Apex_JSON.
Andy In The CloudAndy In The Cloud
Hi Arun, just wondering did you ever create your library?