Skip to main content

xml_to_json

Function xml_to_json 

Source
pub fn xml_to_json(input: &str) -> Result<Value, CamelError>
Expand description

Convert an XML string to a JSON value.

Whitespace in text content is trimmed (leading/trailing) consistently with Apache Camel XJ behavior. For example, <name> Alice </name> produces {"name": "Alice"} — the surrounding spaces are removed. Indentation whitespace between elements is also ignored via trim_text(true) on the reader.

§Errors

Returns CamelError::TypeConversionFailed if the input is not well-formed XML, contains multiple root elements, or is empty.