JSON to XML Converter

Convert JSON into well-formed XML.

Developer Tools Free, no sign-up Runs in your browser

JSON to XML Converter tool

XML has no arrays, so each entry becomes a repeated element.

About the JSON to XML Converter

JSON to XML Converter rewrites a JSON document as XML. It is most often needed when a modern service produces JSON and an older system, a SOAP endpoint or an enterprise import routine insists on XML.

The two formats do not map perfectly onto one another, so the conversion makes some decisions and tells you what they are. JSON object keys become element names. Values become element text. Arrays become repeated sibling elements, named after the key where that produces a valid name, because XML has no array type of its own.

Names are the sharp edge. XML element names cannot start with a digit, cannot contain spaces, and cannot be empty, while JSON keys can be any string at all. Keys that would produce invalid names are rewritten predictably and the change is reported, so you are never handed XML that silently will not parse.

Escaping is handled throughout: ampersands, angle brackets and quotes in values are turned into entities, so text containing markup does not break the document. The output is indented and ends up parsing cleanly in any XML reader.

Everything runs inside your browser. Nothing you paste is uploaded, logged or stored, which matters when the input is a client list, an internal URL map or anything else you would not post publicly.

How to use the JSON to XML Converter

  1. Paste your JSONAny valid JSON document: object, array or single value.
  2. Set the root element nameXML needs exactly one root; JSON does not have the concept.
  3. Choose the indentationTwo spaces, four spaces or tabs.
  4. Copy or download the XMLThe result is well-formed and ready to use.

Features

  • Well-formed, indented XML output
  • Arrays become repeated sibling elements
  • Invalid element names rewritten and reported, never silently broken
  • Correct escaping of ampersands, angle brackets and quotes
  • Configurable root element name
  • Clear JSON parse errors with the position of the problem
  • Runs entirely in your browser

Who uses this tool

The json to xml converter is used by writers, developers, students, marketers and anyone else who needs the job done once without installing software. Common cases include:

  • Feeding JSON data into a system that only accepts XML
  • Preparing a payload for a SOAP service
  • Converting a configuration file between formats
  • Producing XML for an import routine
  • Comparing how the same data looks in both formats

Frequently asked questions

How are arrays converted?

As repeated sibling elements sharing the key's name, because XML has no array type. A key called items holding three values produces three item elements inside an items element.

What happens to keys that are not valid XML names?

They are rewritten to something valid, with invalid characters replaced and a leading letter added where a name began with a digit. Every change is listed, so nothing happens behind your back.

Does it add an XML declaration?

Yes, a standard UTF-8 declaration at the top, which is what most parsers expect.

Are attributes produced?

No. Everything becomes an element, because JSON has no way to distinguish an attribute from a child value. If you need attributes, the usual convention is to post-process the result.

Is special characters handling correct?

Yes. Ampersands, angle brackets and quotes are escaped as entities, so values containing markup do not break the document.

Is my data uploaded?

No. The conversion runs entirely in your browser.

If the json to xml converter is not quite what you need, these other free tools solve closely related problems.

XML to JSON Converter

Turn an XML document into JSON, with attributes and text content preserved.

Developer Tools Use tool

JSON Formatter

Pretty-print and validate JSON, with the exact line and column of any error.

Developer Tools Use tool

XML Formatter

Pretty-print XML with proper indentation, and catch malformed documents.

Code Formatters Use tool

JSON to CSV Converter

Convert an array of JSON objects into CSV, with nested fields flattened.

Developer Tools Use tool

YAML to JSON Converter

Translate between YAML and JSON, with clear errors on invalid indentation.

Developer Tools Use tool