Search tools

Search for a command to run...

XML ↔ JSON Converter

Convert XML to JSON and JSON back to XML, keeping attributes (as @name) and repeated elements (as arrays).

How to use

  1. 1Choose the direction.
  2. 2Paste XML or JSON; attributes appear as keys starting with @.

Frequently asked questions

How are XML attributes represented?

As keys prefixed with @, e.g. <book id="7"> becomes { "book": { "@id": "7" } }. Turn attributes off to drop them.

How are repeated elements handled?

Two or more sibling elements with the same name become a JSON array.

Where does text go when an element also has attributes?

Into a #text key, e.g. <p lang="en">Hi</p> becomes { "p": { "@lang": "en", "#text": "Hi" } }.