Processing stays in your browser

XML ↔ JSON converter

Convert XML to JSON or JSON to XML online. Inspect element values and attributes, validate syntax, and download the result with no account required.

Attributes use @_ names. Element text is kept as strings.

How to convert XML and JSON

  1. Select the conversion direction and paste your source.
  2. Select Convert to validate and transform the document.
  3. Review the output. XML attributes use the @_ prefix and text content can use #text in JSON.

Common questions

How are XML attributes represented in JSON?

Attribute names receive an @_ prefix, so <item id="7"> maps the attribute to @_id. The converter uses the same convention when building XML from JSON.

Will the XML output be identical to the original?

Not necessarily. JSON and XML have different data models. Formatting, comments, namespaces, mixed content, and element ordering may not round-trip exactly; inspect the result before using it in a system that requires an exact XML representation.

Why does JSON to XML need one root element?

An XML document needs one enclosing element. Use a JSON object with a single top-level property, such as {"catalog":{"item":"Notebook"}}, so the converter can produce one document root.

Can I convert XML with a DOCTYPE declaration?

No. This converter rejects DOCTYPE declarations. Use XML that contains only the data you need and does not rely on external entities. It is a data converter, not an XML Schema validator.

Continue with another tool