Utils365

Convert XML to JSON

Turn XML documents and feeds into JSON you can work with.

Paste XML, open a .xml file, or drop one here

Next: JSON formatter · YAML to JSON · JSON to CSV

Report a problem with this tool

How to use XML to JSON

  1. Paste your XML

    Paste XML, or open or drop a .xml file. It’s checked and converted as you type.

  2. Choose the options

    Detect numbers and true/false, or keep every value as text. Pick 2 or 4 spaces, or one line.

  3. Copy or download

    Copy the JSON, or download it as a .json file.

Why use Utils365

  • Attributes kept

    Attributes become keys starting with @_, and an element’s text next to them becomes #text, so nothing in the XML is lost.

  • Lists where you expect them

    Elements that repeat, like several <book> elements, become a JSON array.

  • Errors you can fix

    Unclosed or mismatched tags, unquoted attributes and stray characters are named with the line and column.

  • Private by design

    Your XML is converted on your device and never uploaded.

Frequently asked questions

How are attributes converted?

Each attribute becomes a key with @_ in front, like "@_id": 1. If the element also has text, the text is kept as "#text".

Are numbers and booleans detected?

Yes, by default: 42, 9.90 and true become JSON numbers and booleans, written exactly as in the XML. Values with leading zeros, like 007 or ZIP codes, stay text. Untick the option to keep every value as text.

Why is one element an array and another not?

An element that appears more than once becomes an array; one that appears once is a single value. Converting the JSON back to XML gives the same elements either way.

What happens to comments, CDATA and the XML declaration?

Comments and the <?xml ?> declaration are left out. CDATA sections are kept as plain text, and entities like &amp; and &#233; are decoded.

Is it safe to convert untrusted XML?

Yes. Entities defined in a DOCTYPE aren’t expanded recursively, so files built to blow up in size can’t freeze the page.