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
Basic Configuration
Learn the node setup and input/output structure
Conversion Examples
See real-world XML to JSON transformation patterns
Error Handling
Handle malformed XML and processing errors gracefully
Integration Patterns
Combine with other nodes for complete data workflows
Configuration
Inputs
| Name | Code | Type | Required | Description |
|---|---|---|---|---|
| XML String | xml | Text | ✅ Yes | Well-formed XML document to convert |
Outputs
| Name | Type | Description |
|---|---|---|
| object | Object | Parsed 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 Structure | JSON Representation | Example |
|---|---|---|
| Element Text | {"#text": "value"} | <name>John</name> → {"name": {"#text": "John"}} |
| Attributes | {"@attr": "value"} | <user id="123"> → {"user": {"@id": "123"}} |
| Child Elements | Nested objects | <user><name>John</name></user> → {"user": {"name": {"#text": "John"}}} |
| Repeated Elements | Arrays | <items><item/><item/></items> → {"items": {"item": [...]}} |
| Mixed Content | Combined structures | <p>Text <b>bold</b> text</p> → Complex object with #text and elements |
| Namespaces | Preserved 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/APIExample Integration Workflow
Best Practices
Best Practices
- Validate XML structure before conversion using pre-processing nodes
- Handle arrays consistently - check if result is array or single object
- Extract text content using
['#text']property access - Process attributes with
['@attributeName']syntax - Implement error handling for malformed XML scenarios
- 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
| Problem | Cause | Solution |
|---|---|---|
| Conversion fails | Malformed XML | Validate XML structure before conversion |
| Missing data | Incorrect property access | Use #text for element content, @attr for attributes |
| Array handling errors | Single vs multiple elements | Check Array.isArray() before iteration |
| Attribute access fails | Missing @ prefix | Use @attributeName syntax |
| Namespace issues | Complex namespace declarations | Preserve namespace prefixes in property names |
Related Nodes
File Storage
Store and retrieve XML files for processing workflows
Transaction
Ensure atomic operations when processing converted data
JavaScript Execution
Process converted JSON data with custom logic
Database Operations
Store converted data in databases with proper structure
Next: Explore File Storage for managing XML documents and processed results, or learn about Transaction Management for atomic data operations.