XML to JSON Converter

Convert XML to JSON or JSON back to XML entirely in your browser.

About this converter

XML attributes become JSON keys prefixed with @_. Repeated XML elements become JSON arrays. JSON values with that prefix are written back as XML attributes.

Share on LinkedInShare on X
Link to this tool

Copy this HTML to cite this tool from your own site or article.

About XML to JSON Converter

XML to JSON Converter converts XML documents to structured JSON objects and converts JSON objects back into valid XML markup.

How to use XML to JSON Converter

  1. Paste XML or JSON source into text editor pane.
  2. Select conversion mode: XML to JSON or JSON to XML.
  3. Toggle options for attribute handling and root wrapper tags.
  4. Click Convert and copy converted output data.

Examples

XML Input: <user id="1"><name>Alice</name></user> JSON Output: {"user":{"@id":"1","name":"Alice"}}

FAQ

How are XML tag attributes represented in JSON?

Attributes are assigned a configurable key prefix (by default @) inside the parent JSON object.

Are XML self-closing tags supported?

Yes. Self-closing tags like <item /> convert cleanly to empty JSON properties or null values.