# XML ↔ JSON converter

Canonical page: https://datalens.flazetech.in/xml

Publisher: DataLens by Flazetech (https://datalens.flazetech.in/about).

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

## 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.

## Data handling

[Processing and privacy](https://datalens.flazetech.in/privacy). Formatting and conversion run in the browser. Optional sharing and API requests can transmit supplied data. The interactive tools require JavaScript; this reference does not.
