JSON to XML Converter
Turn JSON into indented, well-formed XML with proper escaping.
Convert XML into readable JSON.
XML to JSON Converter parses an XML document with your browser's own XML parser and rewrites it as JSON. It is the conversion you need when something upstream still speaks XML and everything you are writing speaks JSON.
XML carries information JSON has no direct equivalent for, so the output follows a convention rather than inventing one. Attributes are collected under an @attributes key, element text goes into #text when the element also has attributes or children, and repeated sibling elements become an array. That convention is widely used, predictable, and reversible.
Validation comes first. The document is parsed strictly before anything is converted, so a missing closing tag or a stray ampersand produces a clear message naming the line rather than half-converted output. XML is unforgiving by design, and a converter that papers over that is worse than useless.
Namespaces, CDATA sections, comments and processing instructions are all handled rather than discarded or mangled.
Everything runs inside your browser. Nothing you paste is uploaded, logged or stored, which matters when the input is a client list, an internal URL map or anything else you would not post publicly.
The xml to json converter is used by writers, developers, students, marketers and anyone else who needs the job done once without installing software. Common cases include:
Under an @attributes key on the element's object by default, which keeps them clearly separate from child elements. You can also merge them in directly if your consumer prefers that.
They become an array. A single occurrence produces a plain object, which is the usual convention, so check for both shapes if the number of elements can vary.
You get a clear error naming the line and the problem, and no output. XML is strict by design and silently guessing would hide the fault rather than fix it.
Yes. Prefixed names are preserved as they appear, so xsi:type stays xsi:type.
Yes. CDATA content becomes ordinary text in the JSON, which is what it represents.
No. Parsing and conversion both happen in your browser.
If the xml to json converter is not quite what you need, these other free tools solve closely related problems.
Turn JSON into indented, well-formed XML with proper escaping.
Pretty-print XML with proper indentation, and catch malformed documents.
Pretty-print and validate JSON, with the exact line and column of any error.
Translate between YAML and JSON, with clear errors on invalid indentation.
Turn spreadsheet data into JSON, or JSON records back into CSV rows.