I am looking to create an XML format based on my JSON data, rather than converting it from JSON to XML.
Here is an example of the JSON I want to convert to XML:
var jsonData = { "Smart Shoes":{
"Product":"Smart Shoes",
"Price":24.99,
"Quantity":"1x "
},
"Denim Jeans":{
"Product":"Denim Jeans",
"Price":30,
"Quantity":"1x "
}
}
I aim to generate XML in a similar format as shown below:
<xml id="POSCMD" LateProcessing="true">
<commands>
<injectfieldmacro type="field" name="FIELD_CLEAR"/>
forEach(Item in Basket) {
<injectdata type="literal" data="{Item.UPC}"/>
<injectfieldmacro type="field" name="FIELD_UPC"/>
}
</commands>
</xml>