🔄 JSON to XML / XML to JSON Converter

Convert between JSON and XML formats with pretty-print output, attribute support via @attr convention, and configurable indentation.

Last updated: May 18, 2026 · By Λ

Free JSON to XML / XML to JSON Converter

Convert JSON objects and arrays to well-formed XML, or parse XML documents back into structured JSON. Supports nested objects, arrays (wrapped in repeating element tags), and the @attr convention for XML attributes. The @attr convention lets you define XML attributes in your JSON by prefixing keys with the @ symbol. Arrays are converted to repeated sibling elements with the same tag name. You can configure indentation (2 or 4 spaces) and the root element name. XML to JSON conversion uses the browser's built-in DOMParser for reliable parsing. Both directions are computed by the script embedded in this page, which means your payloads get converted on your own hardware rather than being uploaded for processing.

What is a JSON to XML Converter?

A JSON to XML converter translates data between two of the most widely used structured data formats in software development. JSON (JavaScript Object Notation) is a lightweight, human-readable format that dominates modern web APIs and configuration files. XML (Extensible Markup Language) is a more verbose, tag-based format still heavily used in enterprise applications, SOAP web services, RSS feeds, and configuration files for platforms like Java, .NET, and Android. Converting between these formats is essential when integrating systems that speak different data languages.

This free browser-based tool converts in both directions. You can transform a JSON object into well-formed XML with a configurable root element name and indentation, or parse an XML document back into structured JSON. It supports the @attr convention for XML attributes and handles arrays by generating repeated sibling elements. Because the tool uses the browser's built-in DOMParser for XML parsing, you get reliable, standards-compliant results. No data ever leaves your device.

How to Use This Tool

  1. Paste your JSON into the left panel or your XML into the right panel. You can also click "Sample" to load example data.
  2. Set your preferred indentation (2 or 4 spaces) and root element name using the options at the top.
  3. Click the conversion button in the center: "JSON to XML" or "XML to JSON" depending on your direction.
  4. Copy the result using the Copy button in the output panel header, or modify the output directly in the text area.

Key Features

Frequently Asked Questions

What is the @attr convention?

The @attr convention is a common pattern for representing XML attributes in JSON. When a JSON key starts with the @ symbol (for example, "@isbn"), the converter generates it as an XML attribute on the parent element rather than a child element. This allows you to produce attribute-rich XML output from a JSON source without any special configuration.

How are JSON arrays represented in XML?

Each item in a JSON array becomes a repeated XML element sharing the same tag name as the array key. For example, a JSON key "book" containing three objects produces three separate <book> elements in the XML output. When converting XML back to JSON, the tool detects repeated sibling elements and groups them into a JSON array.

Can this tool handle large XML or JSON documents?

Yes. The tool processes data directly in your browser, so the practical limit depends on your device's available memory. Documents up to several megabytes convert without issues on modern devices. Real-time character and line counts are shown beneath each panel so you can track document size.

Does the converter handle XML namespaces?

The tool focuses on standard element and attribute conversion. XML namespace prefixes will be preserved as part of the tag name during XML-to-JSON conversion. For most use cases involving configuration files, API payloads, and data exchange, this provides correct and usable results.

Related tools