JSON → XML

About the JSON ↔ XML playground

The JSON ↔ XML converter turns JSON data into equivalent XML markup and XML back into JSON. Object keys become element names, nested objects become nested elements, and arrays become repeated elements. This is useful when integrating with systems that expect XML — such as legacy SOAP services or RSS-style feeds — while your application works natively in JSON, or vice versa when consuming XML feeds in a JSON pipeline.

JSON represents data as key/value objects and arrays and is the default for modern web APIs. XML is a verbose, tag-based markup language that wraps data in named, nestable elements with optional attributes and a single root. The two models are similar but not identical: XML distinguishes attributes from child elements and has no native array type, so the converter applies consistent conventions to bridge those differences in both directions.

HostedJSON ↔ XML runtime
mainentry file
single fileworkspace
stdinprogram input

How it works

1

Write

The main file is the entry point for each run.

2

Give it input

Use the Input panel to pipe standard input to your program when it needs data.

3

Run

Run sends your code to a fresh hosted runtime and streams the result into the output panel.

4

Keep or share

Your draft stays in this browser, and Share creates a separate snapshot link.

External resources

  • w3.org/XML— Official website

Input (JSON)

{
  "user": {
    "id": 1,
    "name": "Ada"
  }
}

Output (XML)

<user>
  <id>1</id>
  <name>Ada</name>
</user>

Input (XML)

<book>
  <title>SQL</title>
  <pages>120</pages>
</book>

Output (JSON)

{
  "book": {
    "title": "SQL",
    "pages": "120"
  }
}

Input (JSON with array)

{
  "list": {
    "item": ["a", "b"]
  }
}

Output (XML)

<list>
  <item>a</item>
  <item>b</item>
</list>

Input (XML nested)

<order>
  <id>7</id>
  <customer>
    <name>Ada</name>
  </customer>
</order>

Output (JSON)

{
  "order": {
    "id": "7",
    "customer": {
      "name": "Ada"
    }
  }
}

Input (JSON deep nesting)

{
  "catalog": {
    "book": {
      "title": "SQL",
      "author": "Ada"
    }
  }
}

Output (XML)

<catalog>
  <book>
    <title>SQL</title>
    <author>Ada</author>
  </book>
</catalog>

Input (JSON with attribute)

{
  "a": {
    "@id": "1",
    "#text": "Ada"
  }
}

Output (XML)

<a id="1">Ada</a>

Input (XML with attribute)

<price currency="USD">9.99</price>

Output (JSON)

{
  "price": {
    "@currency": "USD",
    "#text": "9.99"
  }
}

How it works

The editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.

Both directions

Paste JSON to produce equivalent XML markup, or paste XML to get JSON back.

Object keys become element names and nested objects become nested elements.

JSON arrays become repeated sibling elements with the same tag name.

Bridging the model gap

XML has no native array type, so repeated elements stand in for list items.

Attributes are distinguished from child elements using consistent conventions.

A single XML root wraps the JSON structure as required by XML.

When to use it

Feeding JSON data to legacy SOAP services or RSS-style feeds that expect XML.

Consuming an XML feed inside a JSON-native pipeline.

Privacy

Both conversions run locally in your browser — your data is never sent anywhere.

Works offline once the page has loaded.

Every shortcut, searchable:

Editing

Undo
Ctrl+Z
Redo
Ctrl+⇧+Z
Select next occurrence
Ctrl+D
Delete line
Ctrl+⇧+K
Move line up / down
Alt+↑ / ↓
Copy line up / down
Alt+⇧+↑ / ↓
Toggle comment
Ctrl+/
Indent line
Ctrl+]
Outdent line
Ctrl+[

Navigation

Find
Ctrl+F
Find & replace
Ctrl+H
Go to line
Ctrl+G
Go to symbol
Ctrl+⇧+O

Selection

Select all
Ctrl+A
Select line
Ctrl+L
Select all occurrences
Ctrl+⇧+L
Shortcuts follow your OS — ⌘ becomes Ctrl on Windows and Linux.
It converts JSON into nested XML elements and converts XML back into JSON objects, mapping keys to element names and arrays to repeated elements.
Yes. You can convert JSON to XML or XML to JSON. Note that XML values become strings in JSON, since XML text has no inherent number or boolean type.
No. Everything runs in your browser, so your data never leaves your device or reaches a server.
Yes, it is free with no sign-up or usage limits.
Nested JSON objects become nested XML elements, and arrays become repeated sibling elements sharing the same tag name, so deep structures are preserved.
json
xml

Output

XML output

>_compilebytes

A fast place to write code and run it in isolated hosted runtimes. Free, forever.

Playgrounds

Python compilerC compilerJavaScript compilerC++ compilerTypeScript compilerGo compilerJava compilerRust compiler
All playgrounds →

Tools

JSON formatterRegex testerBase64 encoderJWT decoder
JSON formatterBase64 encoder & decoderRegex testerJWT decoder
All tools →

Company

TermsPrivacy[email protected]
© 2026 compilebytes115 runtimes · no signup115 runtimes · isolated sandboxes · no signup