Skip to content

Latest commit

 

History

History
85 lines (58 loc) · 3.12 KB

File metadata and controls

85 lines (58 loc) · 3.12 KB
description
This page provides the technical details of the XML to JSON policy

XML to JSON

Overview

You can use the xml-json policy to transform XML content into JSON content.

Functional and implementation information for the xml-json policy is organized into the following sections:

Examples

{% hint style="warning" %} This policy can be applied to v2 APIs, v4 HTTP proxy APIs, and v4 message APIs. It cannot be applied to v4 TCP proxy APIs. {% endhint %}

{% tabs %} {% tab title="HTTP proxy API example" %} Example request configuration:

{
    "name": "Xml to Json",
    "description": "",
    "enabled": true,
    "policy": "xml-json",
    "configuration": {}
 }

{% endtab %}

{% tab title="Message API example" %} Example subscribe configuration:

{
    "name": "Xml to Json",
    "description": "",
    "enabled": true,
    "policy": "xml-json",
    "configuration": {}
}

{% endtab %} {% endtabs %}

Configuration

Phases

The phases checked below are supported by the xml-json policy:

v2 PhasesCompatible?v4 PhasesCompatible?
onRequestfalseonRequestfalse
onResponsefalseonResponsefalse
onRequestContenttrueonMessageRequesttrue
onResponseContenttrueonMessageResponsetrue

Reference

The xml-json policy can be configured with the following options:

PropertyRequiredDescriptionTypeDefault
scopetrueThe execution scope (request or response).stringRESPONSE

Compatibility matrix

The following is the compatibility matrix for APIM and the xml-json policy:

Plugin VersionSupported APIM versions
1.x3.x
2.x4.0+

Errors

HTTP status codeMessage
500The transformation cannot be executed properly

Nested objects

To limit the processing time and memory consumption in case of nested object, a default max depth of nested object has been defined to 100. This default value can be overridden using the environment variable gravitee_policy_xmljson_maxdepth.

Changelogs

{% @github-files/github-code-block url="https://github.com/gravitee-io/gravitee-policy-xml-json/blob/master/CHANGELOG.md" %}