The interceptor performs a generic XML-to-JSON transformation using a structural mapping of XML elements and attributes to JSON objects. While this works well for simple and data-oriented XML, it has inherent limitations and challenges.
In particular:
- XML attributes and elements are both mapped to JSON properties, which can lead to ambiguities.
- Element order, mixed content, and namespaces may not be preserved in a meaningful way.
- Repeated elements are heuristically converted into JSON arrays, which may not match the intended domain model.
This interceptor is intended for integration scenarios where XML is used as a transport format and the JSON representation is primarily consumed by applications that do not require full fidelity of the original XML structure.
For complex XML schemas or contract-driven integrations, a dedicated transformation using a template, XSLT or a schema-aware mapping is recommended.
Syntax
xml2Json:
convertNilAttributeToNull: <boolean>
forceList:
- <object>
keepString: <boolean>
xml2Json:
convertNilAttributeToNull: <boolean>
forceList:
- <object>
keepString: <boolean>
Attributes
| Name | Required | Default | Description | Examples |
|---|---|---|---|---|
| convertNilAttributeToNull | false | - | If true, converts xsi:nil="true" on elements into JSON null values. | - |
| forceList | false | - | - | - |
| keepString | false | - | If true, keeps element text values as Strings instead of trying to coerce them into Number/Boolean types during XML-to-JSON conversion. | - |