JSON Central

XML to JSON Converter

Turn safe XML into formatted JSON locally

Preserve namespace-qualified names, control attributes and text nodes, and copy or download JSON without uploading the source.

Browser-local conversion

Convert safe XML into formatted JSON

0 characters · 0 bytes

Waiting for XML.
No conversion yet

Parsing runs entirely in this browser. DTDs and entity declarations are rejected.

Deterministic mapping

Choose how XML details appear in JSON

Repeated sibling elements become arrays. Namespace prefixes remain part of element and attribute names. Attributes can use an @_ prefix, be grouped under @attributes, or be omitted.

Text-node handling

Keep text explicitly under #text, including on simple elements, or collapse simple text to a direct JSON value.

Security and diagnostics

Unsafe declarations stop before parsing

DTD and entity declarations are rejected with line and column details. Other malformed XML is validated before conversion and receives a precise parser diagnostic.

Not inherently lossless

XML and JSON have different data models. This mapping is documented and deterministic, but comments, mixed-content order and some type distinctions cannot be assumed to survive a round trip.

FAQs

XML-to-JSON questions

Are namespace prefixes removed?

No. Qualified element and attribute names keep their prefixes, and namespace declaration attributes are preserved unless attributes are omitted.

Can XML entities be expanded?

No. DTD and entity declarations are rejected to avoid unsafe expansion.