I have a requirement where I want to convert the JSON response , which is an array of object , to the customized XML format , so that my already existing code can parse it.
I know there is a Azure Transformation Policy named <json-to-xml />
, but there is no customization possible with it.
Sample JSON Response:
{
"data":[
{"a":1,"b":2},
{"a":3,"b":4}
],
"param2": "Success",
"param3": "true"
}
Desired XML Format:
<result>
<sub-res>
<res x="a" y=1>
<res x="b" y=2>
</sub-res>
<sub-res>
<res x="a" y=3>
<res x="b" y=4>
</sub-res>
</result>
I have tried using the liquid template as well but no success. Need guidance or pointers on this.