Skip to main content

XML to JSON Converter

Paste an XML document and get a deterministic JSON representation, produced entirely in your browser.

JSON cannot represent every XML feature exactly. Unsupported structures are rejected or simplified according to the documented mapping.

Processed locally in your browser

How to use it

  1. Paste your XML document into the input area
  2. Choose an indentation option: 2 spaces, 4 spaces, or compact
  3. Select Convert to JSON
  4. Review the JSON output and use Copy to copy it

Element attributes are kept under an "@attributes" object, and every attribute and text value stays a string, so "true" or "00123" is never turned into a boolean or a number. Repeated sibling elements become a JSON array while a single element stays a direct value, and the original element order is preserved rather than sorted. Namespace prefixes and xmlns declarations are kept as written, CDATA sections become plain text, and comments, processing instructions and the XML declaration are dropped. For safety the converter refuses any DOCTYPE or ENTITY declaration before parsing, so external entity references and entity-expansion attacks cannot be processed, and it rejects mixed text-and-element content, multiple root elements and malformed markup instead of guessing a correction. Input is limited to about 2 MB, conversion runs only when you select Convert, and nothing you paste is uploaded, logged or stored. JSON cannot represent every XML feature exactly, so unsupported structures are rejected or simplified according to the documented mapping.

FAQ

We use cookies to run this site and, with your consent, to understand usage and personalize ads. You can change your choice at any time.