logo_smallAxellero.io

Data Converter

Convert XML documents to JSON objects for easier processing and data integration.

Data Converter

Convert XML documents into structured JSON objects for integration with JSON-based APIs, databases, and processing workflows. Used for handling legacy XML systems and data pipelines.

Quick Navigation

Configuration

Inputs

NameCodeTypeRequiredDescription
XML StringxmlText✅ YesWell-formed XML document to convert

Outputs

NameTypeDescription
objectObjectParsed JSON object with XML structure preserved

XML Validation Required

The input XML must be well-formed. Malformed XML will cause conversion errors and workflow failures.

Conversion Examples

Simple XML Elements

XML to JSON Mapping Reference

XML StructureJSON RepresentationExample
Element Text{"#text": "value"}<name>John</name>{"name": {"#text": "John"}}
Attributes{"@attr": "value"}<user id="123">{"user": {"@id": "123"}}
Child ElementsNested objects<user><name>John</name></user>{"user": {"name": {"#text": "John"}}}
Repeated ElementsArrays<items><item/><item/></items>{"items": {"item": [...]}}
Mixed ContentCombined structures<p>Text <b>bold</b> text</p> → Complex object with #text and elements
NamespacesPreserved prefixes<ns:tag>{"ns:tag": {...}}

Error Handling

Common XML Parsing Errors

The Data Converter will fail on malformed XML. Always validate XML structure before conversion.

Error Prevention Strategies

Integration Patterns

Complete Data Processing Pipeline

Workflow Pattern

Data Converter is used in multi-step workflows combining validation, conversion, and processing.

XML Source → Validation → Data Converter → JSON Processing → Storage/API

Example Integration Workflow

Best Practices

Best Practices

  1. Validate XML structure before conversion using pre-processing nodes
  2. Handle arrays consistently - check if result is array or single object
  3. Extract text content using ['#text'] property access
  4. Process attributes with ['@attributeName'] syntax
  5. Implement error handling for malformed XML scenarios
  6. Use workflow context to pass converted data to subsequent nodes

Performance Considerations

Performance Notes

  • Large XML documents may cause processing delays
  • Complex nested structures increase parsing time
  • Memory usage scales with XML document size
  • Consider chunking large files or streaming processing for very large documents

Troubleshooting

Common Issues

ProblemCauseSolution
Conversion failsMalformed XMLValidate XML structure before conversion
Missing dataIncorrect property accessUse #text for element content, @attr for attributes
Array handling errorsSingle vs multiple elementsCheck Array.isArray() before iteration
Attribute access failsMissing @ prefixUse @attributeName syntax
Namespace issuesComplex namespace declarationsPreserve namespace prefixes in property names

Next: Explore File Storage for managing XML documents and processed results, or learn about Transaction Management for atomic data operations.