Camel Spring Boot

XSD JSON

Unmarshal XML to JSON and marshal JSON to XML, driven by an XML Schema (an XSD, or the types of a WSDL), which gives the types, arrays, order and namespaces.

What’s inside

Please refer to the above links for usage and configuration details.

Maven coordinates

<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-xsd-json-starter</artifactId>
</dependency>

Spring Boot Auto-Configuration

The starter supports 8 options, which are listed below.

Name Description Default Type

camel.dataformat.xsd-json.attribute-prefix

A prefix for the JSON fields of XML attributes, such as _. By default attributes and child elements share the JSON object without a prefix.

String

camel.dataformat.xsd-json.element

The root element: a global element of the schema, as {namespace}name or as a local name that is unique in the schema. Needed to marshal (JSON to XML) unless includeRoot is enabled. On unmarshal the XML document names its root element, and this option only restricts it. The header CamelXsdJsonElement overrides it per message.

String

camel.dataformat.xsd-json.enabled

Whether to enable auto configuration of the xsdJson data format. This is enabled by default.

Boolean

camel.dataformat.xsd-json.ignore-unknown

Whether to skip XML elements and attributes, or JSON fields, that the schema does not declare, instead of failing.

false

Boolean

camel.dataformat.xsd-json.include-root

Whether the JSON holds the root element as its single field, such as \{getOrder: \{…​}}, instead of the content of the root element.

false

Boolean

camel.dataformat.xsd-json.pretty-print

Whether to indent the output, the JSON on unmarshal and the XML on marshal.

false

Boolean

camel.dataformat.xsd-json.schema

The XML Schema to use: an .xsd file, or a .wsdl file whose types (every xs:schema in wsdl:types) are read. A resource such as classpath:orders.xsd, file:schemas/orders.wsdl or an https URL. Imports and includes are resolved relative to it, with the same scheme only.

String

camel.dataformat.xsd-json.text-name

The JSON field of the text of an element with simple content and attributes, such as \{currency: EUR, value: 9.95}.

value

String