The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "xml2json",
"nodes": [
{
"parameters": {
"jsCode": "const { xml2json } = require('xml-js');\n\nconst data = $input.all()[0].json.body\nconst xmlString = typeof data.data === 'string' ? data.data.replace(/\\\\\"/g, '\"') : data.data\n\ntry {\n return {data: xmlStringToJson(xmlString)};\n} catch (error) {\n console.log({\n errorMessage: error.message,\n stack: error.stack\n })\n return {error: error.message}; \n}\n\nfunction xmlStringToJson(xmlString) {\n return JSON.parse(\n xml2json(xmlString, { spaces: 1, compact: true }));\n}"
},
"id": "1ae47b93-20b3-4801-80ae-2a51fca9c987",
"name": "Code",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
1100,
460
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ JSON.stringify($input.item.json) }}",
"options": {}
},
"id": "e5082bd5-b059-4efb-bdac-e15b1f842656",
"name": "Respond to Webhook",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
1480,
440
]
},
{
"parameters": {
"path": "xml2json",
"responseMode": "responseNode",
"options": {}
},
"id": "a8dee401-3b88-4953-ae32-cb5658671524",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
860,
460
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ !!$json.error }}"
}
]
}
},
"id": "bf222baf-a9d1-4ced-a494-d17136963e3a",
"name": "IF",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1280,
460
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ JSON.stringify($input.item.json) }}",
"options": {
"responseCode": 500
}
},
"id": "602b6b36-480f-4a12-b841-3923b40c0e4c",
"name": "Respond to Webhook1",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
1480,
580
]
},
{
"parameters": {
"httpMethod": "POST",
"path": "xml2json",
"responseMode": "responseNode",
"options": {}
},
"id": "3ba25325-8f8a-4397-8bfb-ddc5a55fc20c",
"name": "Webhook1",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
860,
600
]
}
],
"connections": {
"Code": {
"main": [
[
{
"node": "IF",
"type": "main",
"index": 0
}
]
]
},
"Webhook": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"IF": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
],
[
{
"node": "Respond to Webhook1",
"type": "main",
"index": 0
}
]
]
},
"Webhook1": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {},
"versionId": "5ccf3f13-5618-4217-90fc-348b7d6cd6a2",
"id": "XEHfq3DBZ0duV9Zj",
"tags": []
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
xml2json. Webhook trigger; 6 nodes.
Source: https://github.com/stdioh321/n8n-test/blob/41c7cf6523ec3edbfcd21b46a179198c2b07ba46/workflows/xml2json.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
A production-ready authentication workflow implementing secure user registration, login, token verification, and refresh token mechanisms. Perfect for adding authentication to any application without
Portfolio Orchestrator. Uses httpRequest. Webhook trigger; 59 nodes.
This n8n template demonstrates how a simple Multi-Layer Perceptron (MLP) neural network can predict housing prices. The prediction is based on four key features, processed through a three-layer model.
github code Try yourself
This workflow contains community nodes that are only compatible with the self-hosted version of n8n.