JSON to XML Converter

JSON to XML Converter

Updated August 20, 2026

Convert JSON to XML online. Turn JSON into well-formed XML. Free JSON to XML converter in your browser.

Indent

JSON

0 lines · 0 chars

Loading editor...

XML

0 lines · 0 chars read-only

Loading editor...

Features

  • Turn a JSON object or array into well-formed XML
  • Keys starting with @ become attributes
  • Arrays become repeated sibling elements
  • Choose the root element name
  • Configurable indent
  • Runs locally. API dumps never leave the tab

Common Use Cases

  • Build a test SOAP-like envelope from a JSON fixture
  • Export app state as XML for a legacy importer
  • Wrap a JSON array in a root so XML tools can parse it
  • Generate Android-style nested resources from JSON
  • Round-trip after XML to JSON for a sanity check

How JSON keys become tags

Each object key becomes an element name after a sanitize pass (illegal characters become underscores). Arrays emit the same tag once per item. @id style keys become attributes. #text becomes character data.

JSON arrays at the top level need a root wrapper because XML allows only one document element. Set the root name to something your consumer expects (items, catalog).

Examples

Valid - Object with attribute
{"@id":"1","title":"Go"}
Valid - Array needs a root
[{"n":1},{"n":2}]
Invalid - Invalid JSON
{id:1}

Frequently Asked Questions

Why was my key renamed?

XML names cannot start with a digit or contain spaces. We rewrite those characters so the output still parses.

Do I get an XML declaration?

Yes, UTF-8. Remove it if your host already wraps the payload.

Tips

  • Use @keys for attributes if you plan to round-trip.
  • Pick a root name that matches the target schema, not a generic "root", when you can.