We have a client sending a request similar to the following:
{
"Order": {
"OrderId": "00001282",
"ShippingGroups": {
"ShippingGroup": {
"ShippingGroupId": "sh00005502",
"LineItems": [
{
"LineItem": {
"LineItemID": "plida8055335850643b1aa9331ee3",
"Quantity": "5"
}
},
{
"LineItem": {
"LineItemID": "plia762acad1a4e500029c72590dd",
"Quantity": "5"
}
}
]
}
}
}
}
We are running it through the following JSONtoXML policy:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONToXML enabled="true" continueOnError="false" async="false" name="JSONToXMLPolicy">
<DisplayName>JSONToXMLPolicy</DisplayName>
<FaultRules/>
<Properties/>
<Options>
<NamespaceBlockName>#namespaces</NamespaceBlockName>
<DefaultNamespaceNodeName>$default</DefaultNamespaceNodeName>
<NamespaceSeparator>:</NamespaceSeparator>
</Options>
<OutputVariable>request</OutputVariable>
<Source>request</Source>
</JSONToXML>
The resulting xml converts $..LineItems.LineItem to something like this:
<LineItems>
<LineItem>
<LineItemID>plida8055335850643b1aa9331ee3</LineItemID>
<Quantity>5</Quantity>
</LineItem>
</LineItems>
<LineItems>
<LineItem>
<LineItemID>plia762acad1a4e500029c72590dd</LineItemID>
<Quantity>5</Quantity>
</LineItem>
</LineItems>
However, what we would like it to look like is below. But that doesn’t seem to do it. Is there a clean solution to this? Does it require an xsl transform?
<LineItems>
<LineItem>
<LineItemID>plida8055335850643b1aa9331ee3</LineItemID>
<Quantity>5</Quantity>
</LineItem>
<LineItem>
<LineItemID>plia762acad1a4e500029c72590dd</LineItemID>
<Quantity>5</Quantity>
</LineItem>
</LineItems>