JSON to XML & XML to JSON Converter Convert between JSON and XML.
100% offline
Input99 chars · 8 lines
Output83 chars
Converted · 5 lines
<note id="501">
  <to>Ada</to>
  <from>Linus</from>
  <body>Ship it.</body>
</note>

About JSON to XML & XML to JSON Converter

Convert JSON to XML and XML to JSON right in your browser. Paste a JSON object and get well-formed XML — element nesting, attributes, and repeated arrays all mapped correctly — or paste an XML document and turn it straight back into clean, indented JSON. It's the bridge devs reach for when working with SOAP services, RSS feeds, config files, and the legacy APIs that still speak XML.

Attributes are handled both ways: on the JSON side they surface under a configurable prefix (the standard `@_`), so an XML `<a x="1">` becomes `"@_x": 1` and converts cleanly back. Repeated sibling elements collapse into JSON arrays, and CDATA sections are preserved through the round-trip.

Everything runs locally and fully offline — nothing you paste is ever uploaded, which makes the converter safe for production payloads and sensitive config.

Features

  • JSON → XML with proper element nesting, attributes, and array expansion
  • XML → JSON with attributes mapped to a configurable @_ prefix
  • Repeated elements collapse to arrays; CDATA sections are preserved
  • Powered by fast-xml-parser, runs entirely offline in your browser

How to use

  1. Paste your JSON or XML into the input pane.
  2. Pick the direction — JSON → XML or XML → JSON.
  3. Adjust the attribute prefix if your data uses a different convention.
  4. Copy the converted result from the output pane, or clear and start again.

Frequently asked questions

How are XML attributes represented in JSON?

Attributes are surfaced under keys prefixed with @_ by default, so <a x="1"><b>2</b></a> becomes {"a":{"@_x":1,"b":2}}. You can change the prefix in the toolbar if your data uses a different convention, and the same prefix is used when converting back to XML.

What happens to repeated XML elements?

Sibling elements that share a name collapse into a JSON array. For example <list><item>a</item><item>b</item></list> becomes {"list":{"item":["a","b"]}}, and a JSON array expands back into repeated elements.

Is CDATA preserved?

Yes. CDATA sections are kept under a #cdata key so raw, unescaped content survives the round-trip in both directions.

My JSON has multiple top-level keys — what root does the XML use?

XML must have exactly one root element. If your JSON already has a single top-level key, that becomes the root. Otherwise (multiple keys, an array, or a scalar) the output is wrapped in a <root> element.

Is my data uploaded anywhere?

No. All parsing and conversion happen locally in your browser using fast-xml-parser. Your input never leaves your device, so the converter works offline and is safe for sensitive data.

Everything runs locally in your browser — your input is never uploaded.