Convert JSON to XML

The json-to-xml policy converts a request or response body from JSON to XML.

Policy statement

XML
<json-to-xml apply="always | content-type-json" consider-accept-header="true | false" parse-date="true | false"/>

Example

XML
<policies>
<inbound>
<base />
</inbound>
<outbound>
<base />
<json-to-xml apply="always" consider-accept-header="false" parse-date="false"/>
</outbound>
</policies>

Elements

Name

Description

Required

json-to-xml

Root element.

Yes

Attributes

Name

Description

Required

Default

apply

The attribute must be set to one of the following values:

  • always – always apply conversion.

  • content-type-json – convert only if response Content-Type header indicates presence of JSON.

Yes

N/A

consider-accept-header

The attribute must be set to one of the following values:

  • true – apply conversion if JSON is requested in request Accept header,

  • false – always apply conversion.

No

true

parse-date

When set to false date values are simply copied during transformation

No

true

Usage

This policy can be used in the inbound, outbound, and on-error policy scopes.

Questions? We're always happy to help with any issues you might have! Send us an email to support@youngapp.co or request the demo with our sales team!