I am going to get input request with JSON format like below
{
"Name":"Joe",
"customerId":"1234",
"Age":"12"
}
whereas at Apigee side I need to convert this request into XML format like below
<ser:root xmlns:ser="http://test.com">
<Name>Joe</Name>
<customerId>1234</customerId>
<Age>12</Age>
</ser:root>
There is no extra conversion required; the only requirement is the root element namespace. I want to achieve this without javascript or xslt policy. Please assist. The JSON_XML policy doesn't help in with the root namespace. Attribute names are dynamic, meaning another request I can get country or address. So I can't extract individual attributes.
@dchiesa1 - is this possible without the javascript or xslt policy ?
Solved! Go to Solution.
No, not possible as far as I know. The jsontoxml policy does have an ObjectRootElementName configuration element, which allows you to specify the "root" as your desired root element name. But it does not have the corresponding ObjectRootElementNamespace . That would be a good extension. In fcat it's so obvious that I 'm surprised I haven't heard this request previously, and I'm surprised the builtin policy doesn't already do this.
The way I would do it is, either pre-process with JS or post-process with XSLT, as you implied.
Good luck.
No, not possible as far as I know. The jsontoxml policy does have an ObjectRootElementName configuration element, which allows you to specify the "root" as your desired root element name. But it does not have the corresponding ObjectRootElementNamespace . That would be a good extension. In fcat it's so obvious that I 'm surprised I haven't heard this request previously, and I'm surprised the builtin policy doesn't already do this.
The way I would do it is, either pre-process with JS or post-process with XSLT, as you implied.
Good luck.