XML to JSON Converter

Convert XML to JSON or JSON to XML — bidirectional, with attributes and nested elements handled correctly.

How to use

  1. Choose the direction: XML to JSON or JSON to XML.
  2. Paste your data in the input field.
  3. The converted output appears below. Copy it with one click.

About this tool

XML and JSON are the two dominant data interchange formats on the web. APIs, configuration files, SOAP services, RSS feeds and Android manifests use XML; REST APIs, JavaScript applications and NoSQL databases use JSON. Converting between them is a routine need when integrating systems that speak different formats.

The conversion is not lossless in general. XML has features — attributes, namespaces, mixed content, processing instructions, CDATA sections — that have no direct JSON equivalent. This converter handles attributes as an @attributes object and collapses text-only elements to simple values, which covers the vast majority of real-world XML.

Everything runs in your browser using the native DOMParser for XML and JSON.parse for JSON. Your data is not uploaded, stored or logged.

Frequently asked questions

How are XML attributes represented in JSON?

As an @attributes object on the element. text becomes { "item": { "@attributes": { "id": "1" }, "#text": "text" } }.

Can I convert JSON back to XML?

Yes — switch the direction. The converter wraps the JSON in XML tags. Objects become elements, arrays become repeated elements.

Does my data leave my browser?

No. Parsing runs locally using DOMParser and JSON.parse.

What about namespaces?

Namespace prefixes are preserved as part of the tag name. For simple documents this works; for complex namespace-heavy documents, the conversion may need manual adjustment.

Related tools

Long links? Shorten them for free

Vai.la turns any URL into a short link with click statistics, QR Code and your own biolink.

Vai.la is not responsible for how the tools are used or for decisions made based on their results.