XML to JSON Converter
Free online xml to json converter for developers. Convert XML documents to JSON. Fast and private.
JSON Output
Paste XML above
Embed this tool
Copy and paste the code below into your website to embed this tool for free. An attribution link to The Util Box is required.
<iframe src="https://www.theutilbox.org/embed/xml-to-json" width="600" height="500" frameborder="0" style="border: none; max-width: 100%;" title="Free XML to JSON Converter tool from The Util Box"></iframe> <!-- Free tool by The Util Box — https://www.theutilbox.org/tools/xml-to-json --> <a href="https://www.theutilbox.org/tools/xml-to-json">XML to JSON Converter by The Util Box</a>
Frequently Asked Questions about XML to JSON Converter
XML to JSON Converter — Turn Markup into Data
This XML to JSON converter parses an XML document and produces the equivalent JSON. It is what you need when a legacy system speaks XML and the rest of your stack speaks JSON.
The result is pretty-printed, so it can be pasted straight into the JSON Formatter or read as it is.
How the Structure Is Mapped
- Child elements become object keys, named after the element.
- Repeated elements become arrays, so two
<item>elements give a two-element array rather than one overwriting the other. - Text content becomes the value, with surrounding whitespace trimmed.
- Attributes are included on the element that carries them, so a
id="7"attribute appears in the output alongside the child elements.
Honest Limits
- The parser is a regular expression, not a real XML parser. It matches elements and their attributes textually, so mixed content — text and elements interleaved inside one parent — is not handled the way a full parser would handle it.
- Namespaces are not resolved. A prefixed name such as
soap:Envelopekeeps its prefix and no namespace is resolved or stripped. - No schema validation happens. A document with the wrong shape converts perfectly happily.
- Text and attributes can collide, so an element with both a text value and attributes does not round-trip cleanly.
Related Developer Tools
- XML Formatter — indent the document first so you can read the structure.
- XML Validator — check it is well formed before converting.
- XML to YAML — the same conversion into a configuration format.
- XML Minifier — strip the whitespace back out.
- JSON Formatter — reformat the result.
- JSON Path Tester — pull a value out of the result.
- JSON Diff — compare two conversions.
- JSON Schema Validator — check the result against a schema.
The conversion runs entirely in your browser — your XML is never uploaded.