JSON XML Converter

Convert JSON to XML and XML back to JSON in the browser.

  • Runs locally in your browser
  • No upload required

Try it

Paste JSON or XML. It is converted in your browser and never uploaded.

Result
<?xml version="1.0" encoding="UTF-8"?> <json><book><title>JSON</title></book></json>
<?xml version="1.0" encoding="UTF-8"?>
<json><book><title>JSON</title></book></json>

Supported formats

Input
text
Output
text

Privacy

Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.

Processing
In your browser
Privacy level
Browser only

Converted 37 characters from json to xml.

How it works

  • Parsed the input with the pure in-browser engine.
  • Applied the documented XML mapping rules.
  • Collected an explicit warning for every lossy transformation.
  • The conversion produced 1 warning(s); warnings are shown before the result.

Methodology

  1. Parse JSON with the F054 verbatim scanner, or XML with the F056 parser.
  2. Map object members to child elements, @-keys to attributes and #text to text content.
  3. Repeat the element name for arrays and report every lossy step.

Usage

  1. Choose JSON to XML or XML to JSON.
  2. Paste the document.
  3. Run the tool; read any warnings before copying the result.

Examples

These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.

JSON to XML

jsonSelect to copy
{
  "text": "{\"book\":{\"title\":\"JSON\",\"year\":2020}}",
  "direction": "json-to-xml"
}

XML to JSON

jsonSelect to copy
{
  "text": "<book id=\"1\"><title>JSON</title></book>",
  "direction": "xml-to-json"
}

Limitations

XML mapping

A JSON object is emitted as an element whose members are child elements. Keys beginning with @ become attributes and a #text key becomes the element's text content.

Frequently asked questions

How are attributes represented?
An XML attribute becomes a member named @name; text content becomes #text, and JSON keys map to child element names.
Why is my XML number a string?
XML element content is text; the XML→JSON direction cannot know which strings were numbers.
Is my data uploaded?
No. The conversion runs entirely in your browser and is never sent anywhere.

Sources

  1. Extensible Markup Language (XML) 1.0 (Fifth Edition) — W3C
  2. RFC 8259 — The JavaScript Object Notation (JSON) Data Interchange Format — IETF