Skip to content

gravitee-io/gravitee-policy-json-xml

Repository files navigation

JSON to XML transformation policy

Gravitee.io License Releases CircleCI Join the community forum

Phases

V3 engine

onRequestContent onResponseContent

X

X

Jupiter engine

onRequest onResponse onMessageRequest onMessageResponse

X

X

X

X

Compatibility with APIM

Plugin version

APIM version

1.x

3.x

3.x

4.x to latest

Description

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

Configuration

You can configure the policy with the following options:

Property Required Description Type Default

scope (deprecated, v3 only)

X

The execution scope (request or response).

string

REQUEST

rootElement

X

Root element name that’s enclose content.

string

root

Example

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

Errors

V3 engine

Code Description

500

The transformation cannot be executed properly

Jupiter engine

Phase Code Error template key Description

onRequest

400

JSON_INVALID_PAYLOAD

Request payload cannot be transformed properly to XML

onResponse

500

JSON_INVALID_PAYLOAD

Response payload cannot be transformed properly to XML

onMessageRequest

400

JSON_INVALID_MESSAGE_PAYLOAD

Incoming message cannot be transformed properly to XML

onMessageResponse

500

JSON_INVALID_MESSAGE_PAYLOAD

Outgoing message cannot be transformed properly to XML

Nested objects

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