Skip to main content
Feedback

JSON to XML Policy

Transform JSON content to XML content.

Timing

On Request ContentOn Response Content
XX

Configuration

PropertyRequiredDescriptionTypeDefault
scopeyesThe execution scope (request or response).stringREQUEST
rootElementyesRoot element name that’s enclose content.stringroot

Example

Actual JSON response:

{
"details": {
"book": [
{
"category": "fiction",
"author": "Herman Melville"
},
{
"category": "fiction",
"author": "J. R. R. Tolkien"
}
]
}
}

Policy configuration:

"json-xml": {
"scope": "RESPONSE",
"rootElement": "library"
}

XML Transformed output:

<library>
<details>
<book>
<category>fiction</category>
<author>Herman Melville</author>
</book>
<book>
<category>fiction</category>
<author>J. R. R. Tolkien</author>
</book>
</details>
</library>

Errors

CodeDescription
500The transformation cannot be executed properly
note

To limit the processing time, a default max depth of a nested object is 1000.

On this Page