Zero Signup ToolsFree browser tools

Converter Tools

XML to JSON Converter

Convert XML to JSON in your browser. Configurable attribute prefix, text key, value parsing, and force-array tag names with line and column error reporting.

XML to JSON converter

0 chars

Conversion options

Attributes & text
Values & structure
JSON indent

Your XML is parsed and converted entirely on your device. Nothing is uploaded.

How to use

  1. Paste your XML into the input on the left, or click Load sample to try the converter with a small bookstore example.
  2. Read the JSON output on the right. If the XML is malformed, the error message includes the exact line and column.
  3. Pick an attribute prefix (@ or $) and a text key (#text), or switch to Ignore attributes if you want a stripped-down structure.
  4. For tags that should always be arrays (item, book, entry), list them in the force-array field so single occurrences are still wrapped.
  5. Choose minified, 2-space, or 4-space JSON indentation, then click Copy JSON to grab the result.

About this tool

XML to JSON Converter parses XML and emits a clean JSON tree directly in your browser. Paste any XML document on the left and a JSON version appears on the right as you type, with line and column error reporting if the XML is malformed. The conversion follows the conventions used by most XML to JSON libraries: every element becomes a JSON object whose keys are its child element names, attributes (prefixed with a configurable attribute prefix, default @), and an optional text key (default #text) for mixed content. Repeated child elements with the same tag name are grouped into arrays so the JSON tree mirrors the XML structure. Single occurrences stay as objects, but a force-array option lets you pin specific tag names so they are always wrapped in arrays even when they appear once, which is the most common pain point in XML to JSON conversions. Other options include ignoring attributes entirely, collapsing text-only elements (so <year>1999</year> becomes the string 1999 instead of a wrapper object), trimming whitespace-only text nodes (so pretty-printed XML does not pollute the JSON with indentation noise), parsing strings that look like numbers, true, false, or null into their JSON-typed equivalents, and choosing minified, 2-space, or 4-space indentation. The parser handles real-world XML developers actually paste: elements (open, close, self-closing), attributes (single or double quoted), CDATA sections, comments, processing instructions, the standard built-in entities (&amp; &lt; &gt; &quot; &apos;), and numeric character references (&#123; and &#xAB;). Namespace prefixes are preserved verbatim, so soap:Body stays as the key soap:Body. Useful for working with API responses, SOAP envelopes, RSS and Atom feeds, sitemap.xml, AndroidManifest.xml, pom.xml, configuration files, and any legacy XML you need to reshape into JSON for a modern frontend, a documentation example, a test fixture, or a quick exploration in the console. Everything runs locally on your device, so confidential payloads, internal API responses, and any private XML you convert here never leave your browser.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsConverter Tools