Skip to main content
ToolsBay

Runs in your browser — nothing is uploaded · verify

XML to JSON — free, and it runs in your browser

Convert XML documents into readable JSON.

  • For the legacy API, the RSS feed or the export you need to script against.
  • Attributes and text content are both preserved, not one at the expense of the other.
  • Repeated elements become arrays, so the shape is predictable.

XML input

Tab indents · Esc then Tab to leave1 line

JSON output

1 line
  • 70 tools

    Free, with no account and no watermark

  • 0 bytes

    Of your files or text uploaded — this tool runs in the tab

  • No queue

    The work happens in this tab, not in a line behind other users

Three steps, nothing to install

XML to JSON in three steps

  1. XML123456Paste it in — it never leaves the tab

    Paste the XML

    A response from a legacy API, an RSS feed or an export you need to script against.

  2. XMLJSONConverted on your own device

    Convert the structure

    Elements become objects, repeated siblings become arrays, and attributes are kept alongside the text content rather than discarded.

  3. Copy JSON

    Copy the JSON

    Formatted and ready to paste into a script, a fixture or a request.

Why use XML to JSON

  • Attributes survive

    XML carries meaning in both attributes and text nodes. A conversion that keeps only one of them loses half the document, which is why both are represented.

  • Parsed, not pattern-matched

    The input is read with a real parser and the output is written from what it found, rather than by rewriting the text with regular expressions.

  • Your text stays in the page

    What you paste is not transmitted or stored, so an API response full of customer records, a token or an internal query never leaves your machine.

Frequently asked questions

The compact format keeps an element's text separate from its attributes, because an element can have both. Text lands in _text and attributes in _attributes, so <price currency="USD">44.95</price> becomes { _attributes: { currency: "USD" }, _text: "44.95" }.

What changes when XML becomes JSON

The two formats do not describe the same shape of data, so a conversion always makes choices. XML distinguishes attributes from child elements and allows the same tag to repeat; JSON has neither concept. The compact convention used here maps attributes to _attributes, text to _text, and a repeated tag to an array — which is why the output for one <book> and for two of them is not the same shape.

Order is the other thing to watch. XML guarantees document order among sibling elements; JSON object keys do not carry that guarantee, so mixed content — text interleaved with elements — is the case where a round trip is least likely to give you back what you started with.

Working the other way

To go from JSON back to XML, use JSON to XML. To tidy XML before converting it, the XML beautifier re-indents it without changing the content, and JSON formatter does the same for the output.

  • JSON to XML

    Convert JSON structures into equivalent XML markup.

  • XML Beautifier

    Format, minify and check XML without mangling CDATA or attributes.

  • JSON Formatter

    Pretty-print JSON with the indentation you choose, or minify it.

  • Regex Tester

    Test regular expressions live with match highlighting and groups.

  • SQL Formatter

    Indent and align SQL for PostgreSQL, MySQL, SQLite, BigQuery, Snowflake and SQL Server, with keywords capitalised.

  • YAML Validator

    Validate YAML syntax and preview the parsed result as JSON.

Related guides

More tools

70 tools, none of which want your file

Everything this tool does happens in the page you are looking at. No account, no upload, no watermark.