XML to JSON Converter

Convert XML to JSON or JSON to XML in both directions with attributes, nesting, and arrays preserved.

Moving between XML services and JSON APIs means transforming data structures in both directions. This converter translates XML to JSON and back while preserving attributes, nesting, and arrays. It handles the common edge cases that break naive converters. Everything runs locally in your browser.

  1. 01Upload
  2. 02Configure
  3. 03Run
  4. 04Download

Loading tool...

Your document is converted entirely in your browser — it never leaves your device.

FAQ

Frequently asked questions

Everything you need to know about xml to json converter.

How are XML attributes represented in JSON?

Attributes keep an @ prefix, for example @id, so they are never confused with child elements, and repeated elements become JSON arrays.

How is mixed text handled?

Elements that contain both text and children store the text under a #text key, so no content is lost when converting XML to JSON.

Is there a nesting limit?

Yes, for safety the conversion is limited to 8 levels of nesting; deeper structures are collapsed to their text content in XML to JSON mode.

Can I convert JSON back to XML?

Yes. The tool works in both directions: @ keys become attributes, #text becomes element text, and arrays repeat the element name for each item.

Why did my conversion fail?

XML to JSON requires valid XML and reports 'Invalid XML — the document could not be parsed', while JSON to XML requires an object root, not an array or a primitive.

Related tools

same category · same privacy