Data Converter
Convert between various data formats - Base64, Binary, JSON, XML, YAML, CSV, HTML, and more
Actions49
- Base64 Actions
- Binary Actions
- Encoding Actions
- Format Actions
- HTML Actions
- String Actions
Overview
This node operation converts JSON data into XML format. It is useful when you need to transform structured JSON objects into XML documents, which are commonly used in legacy systems, configuration files, or data exchange protocols that require XML input.
Typical scenarios include:
- Integrating with APIs or services that accept XML payloads.
- Generating XML configuration files from JSON data.
- Transforming JSON output from one system into XML for another system.
For example, converting a JSON object like:
{
"person": {
"name": "John",
"age": 30
}
}
into an XML string with a specified root element name such as <root>.
Properties
| Name | Meaning |
|---|---|
| Input JSON | The JSON data to convert into XML. |
| Root Element Name | The name of the root element in the resulting XML document. Defaults to "root". |
| Binary Property Name | (Optional) The name of the binary property to store the output if binary output is used. |
Output
The output is a JSON object containing the converted XML string under the result field. For example:
{
"result": "<root><person><name>John</name><age>30</age></person></root>"
}
If the user opts to output the result as binary data (not shown explicitly in the provided properties but supported generally), the XML content will be stored in a binary property named as specified by the "Binary Property Name" input.
Dependencies
- Uses an internal utility module for format operations to perform the JSON to XML conversion.
- No external API keys or credentials are required.
- No special environment variables needed.
Troubleshooting
- Invalid JSON Input: If the input JSON string is malformed or not valid JSON, the node will throw an error. Ensure the JSON is correctly formatted.
- Root Element Name Issues: Using invalid XML tag names for the root element may cause errors or invalid XML output. Use valid XML element names.
- Large JSON Objects: Very large JSON inputs might lead to performance issues or timeouts depending on the environment.
- Output Binary Option: If enabled but the binary property name is missing or incorrect, the output may not be generated as expected.
Links and References
- XML Specification
- JSON to XML Conversion Concepts
- n8n Documentation on Data Transformation Nodes (general reference)