When I’m converting JSON to XML using the following policy:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONToXML async="false" continueOnError="false" enabled="true" name="JX-TransformInputJsonToXml">
<DisplayName>Transform Input JSON to XML</DisplayName>
<Properties/>
<Options>
<NullValue>NULL</NullValue>
<NamespaceBlockName>#namespaces</NamespaceBlockName>
<DefaultNamespaceNodeName>$default</DefaultNamespaceNodeName>
<NamespaceSeparator>:</NamespaceSeparator>
<TextNodeName>#text</TextNodeName>
<AttributeBlockName>#attrs</AttributeBlockName>
<AttributePrefix>@</AttributePrefix>
<InvalidCharsReplacement>_</InvalidCharsReplacement>
<ObjectRootElementName>Root</ObjectRootElementName>
<ArrayRootElementName>Array</ArrayRootElementName>
<ArrayItemElementName>Item</ArrayItemElementName>
</Options>
<OutputVariable>xmlGeneratedFromJson</OutputVariable>
<Source>request</Source>
</JSONToXML
I notice that is only outputted when I provide a JSON array. For example:
{"foo": "bar"}
will result in:
<foo>bar</foo>
and not
<Root><foo>bar</foo></Root>