Tools, FAQ, Tutorials:
'json-to-xml' Azure API Policy Statement
How to use "json-to-xml" Azure API Policy Statement?
✍: FYIcenter.com
The "json-to-xml" Policy Statement allows you to convert
the body of the inbound request or outbound response
from JSON format to XML format.
For example, the following "json-to-xml" policy statement converts the output response from JSON format to XML format.
<outbound>
<base />
<json-to-xml apply="always" consider-accept-header="false" />
</outbound>
Two attributes used in the above "xml-to-json" policy statement indicate:
For example, Azure receives the following JSON document in the response body from the backend service:
{
"firstName": "John",
"lastName": "Smith",
"isAlive": true,
"age": 25,
"address": {
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": "10021-3100"
},
"phoneNumbers": [
{
"type": "home",
"number": "212 555-1234"
},
{
"type": "mobile",
"number": "123 456-7890"
}
],
"children": [],
"spouse": null
}
The "json-to-xml" policy statement will convert it to an XML document:
<Document>
<firstName>John</firstName>
<lastName>Smith</lastName>
<isAlive>True</isAlive>
<age>25</age>
<address>
<streetAddress>21 2nd Street</streetAddress>
<city>New York</city>
<state>NY</state>
<postalCode>10021-3100</postalCode>
</address>
<phoneNumbers>
<type>home</type>
<number>212 555-1234</number>
</phoneNumbers>
<phoneNumbers>
<type>mobile</type>
<number>123 456-7890</number>
</phoneNumbers>
<children />
<spouse xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</Document>
Note that:
⇒ 'xsl-transform' Azure API Policy Statement
⇐ 'xml-to-json' on Invalid XML
2023-04-25, ∼7628🔥, 2💬
Popular Posts:
How to create the Hello-3.0.epub package? I have all required files to create Hello-3.0.epub. To cre...
What Happens If One Row Has Missing Columns? What happens if one row has missing columns? Most brows...
What Is Azure API Management Service? Azure API Management as a turnkey solution for publishing APIs...
How To Copy Array Values to a List of Variables in PHP? If you want copy all values of an array to a...
Where to get a real Atom XML example? You can follow this tutorial to get a real Atom XML example: 1...