XML ⇄ JSON Converter

Completely free, with no extra charges. You may freely use the output commercially.

About this tool

Convert XML and JSON in both directions with round-trip friendly defaults. Repeated element names stay as scalars until the second occurrence, then become arrays. When a JSON root is an array, the XML side uses <root><item>…</item>…</root> and converts that shape back into an array when returning to JSON.

XML ⇄ JSON conversion

—

How to use

  1. Paste XML or JSON into the left input area.
  2. Choose XML → JSON or JSON → XML.
  3. Adjust indentation, attribute/text keys, namespace handling, and array treatment as needed.
  4. Use the Validate buttons to run syntax checks.

Convert product data and check attributes and arrays, with screenshots

Notes

Examples

XML → JSON:

<user id="42">
  <name>Taro</name>
  <role>admin</role>
  <role>editor</role>
</user>
{
  "user": {
    "@id": "42",
    "name": "Taro",
    "role": ["admin", "editor"]
  }
}

Additional notes

  • Attributes are emitted as [attribute prefix][name] (default @id).
  • Element text content uses [text key] (default #text).
  • Matching element names remain scalars unless there are two or more values, at which point they become arrays.
  • When the JSON root is an array, XML represents it as <root><item>…</item>…</root>; the tag name is configurable.
  • Empty elements with no text or attributes become empty objects {}.

Limitations

The tool aims for structural equivalence, but some type fidelity is impossible because XML lacks native booleans or numbers. For example:

Original JSON:


    "urls": [
             "admin.microsoft.com"
            ],
    "expressRoute": false,
    "id": 160,

Round-tripped JSON:


    "urls": "admin.microsoft.com",
    "expressRoute": "false",
    "id": "160",

This happens because the XML representation cannot guarantee array length or preserve boolean/number types without extra annotations.

All processing happens in your browser; no data is sent.