Toolstia / JSON to XML converter

JSON to XML and XML to JSON converter

Paste JSON to get well-formed XML, or paste XML to get JSON. Arrays, nested objects, null values and special characters are handled. Nothing is uploaded.

JSON arrays become repeated elements. In XML to JSON, attributes get an @ prefix, repeated elements become arrays, and every value stays text because XML has no number type.

How it works

  1. Choose the direction.
  2. Paste your data, or press Use sample.
  3. Copy the result or download it.

JSON to XML rules

Each key becomes an element. An array becomes repeated elements with the same name. A null value becomes an empty element. Characters such as &, < and > are escaped, and keys that are not valid XML names are cleaned up.

Root element

XML needs one root element, and JSON does not. Choose the name of the root element in the box. A JSON array at the top level is written as repeated item elements.

XML to JSON rules

Attributes appear as keys starting with @. Elements that repeat become arrays. Because XML has no number or true/false type, every value comes out as text.

Validation

If the input is not valid, the message says what is wrong so you can fix it. Use the JSON formatter first if you need to tidy the JSON.

Questions

Is my data uploaded?

No. The conversion happens in your browser.

Why did my numbers become text in XML to JSON?

XML stores everything as text, so the tool cannot know which values were numbers.

Can it keep XML comments?

No. Comments are dropped.

Is there a size limit?

Several megabytes is fine on most computers.