Skip to content
FizzKit

XML to JSON

Translate XML into JSON, preserving attributes, text content and element hierarchy, and convert JSON back into well-formed XML. Control the attribute prefix and text-node name, force specific tags to always be arrays, strip namespace prefixes, keep comments and CDATA, and coerce numbers and booleans. Malformed XML is reported with the line and column.

Runs locally in your browser
For large XML, open fullscreen for a wider view
XML input
0 chars · 1 line
JSON output
Output will appear here…
Indent

Repeated sibling elements become arrays; a single child becomes an object unless listed under "Always arrays". Mixed content keeps text under the text-node key.

How to use XML to JSON

  1. 1Choose the direction: XML → JSON or JSON → XML. Swap reverses it using the current output as input.
  2. 2Paste or upload the document; errors point at the line and column.
  3. 3Set the attribute prefix and text-node name, and list any tags that must always become arrays.
  4. 4For JSON → XML, set the root element name and whether to add the XML declaration, then copy or download.

About XML to JSON

Translate XML into JSON, preserving attributes, text content and element hierarchy, and convert JSON back into well-formed XML. Control the attribute prefix and text-node name, force specific tags to always be arrays, strip namespace prefixes, keep comments and CDATA, and coerce numbers and booleans. Malformed XML is reported with the line and column.

XML to JSON is part of FizzKit — a collection of focused developer and ad-tech tools. Because everything runs locally, it works offline once loaded and never exposes your data to a remote server.

Frequently asked questions

Attributes become keys prefixed with @_ (configurable) on the element object, for example { "book": { "@_id": "1", "title": "…" } }. Going the other way, keys with that prefix become attributes.