Docspira

XML ↔ JSON Converter

Paste or upload XML or JSON, choose a direction, and convert. Everything runs locally in your browser; nothing is uploaded.

Output (JSON)

        

How it works

XML is parsed and built entirely in your browser using fast-xml-parser; nothing is sent to a server. Attributes become @_name properties, repeated sibling elements become arrays, and CDATA/comments are kept under their own #cdata/#comment keys.

XML and JSON are not a perfect 1:1 match, so this isn't a "lossless" round-trip tool: mixed text/element content loses its exact interleaving order, XML has no native number/boolean/null types (they come back from JSON as plain text), an empty JSON array has no XML equivalent and is dropped, and a single-item list becomes a plain value if converted back. DOCTYPE/DTD declarations are rejected outright rather than processed. JSON → XML requires an object with exactly one top-level property (the root element), with property names that are valid XML names.

What this tool does

Translate XML to JSON or JSON to XML for integration and debugging.

Before you start

XML attributes, repeated elements and mixed content do not map perfectly to JSON; DOCTYPE declarations are rejected rather than processed.

Privacy

This tool runs in your browser; the text or file you choose is not uploaded for processing. Read the privacy details.