Nested elements
XML parent-child structure is mapped to JSON objects.
Transform XML documents into JSON with a single click. Our converter handles attributes, nested elements, and arrays intelligently, producing clean JSON perfect for APIs, web services, or data interchange. Free, secure, and works entirely in your browser—no XML file touches a server.
Converted output will appear hereXML parent-child structure is mapped to JSON objects.
Attributes are converted alongside element content.
XML content is processed on your device.
import { xml2js } from "xml-js";\nimport { readFile } from "node:fs/promises";\n\nconst xml = await readFile("document.xml", "utf8");\nconst result = xml2js(xml, { compact: true });\nconsole.log(JSON.stringify(result, null, 2));