JSON to XML Converter Online — Free & Private

Generate XML documents for partners that still work with XML or SOAP, without sending your payloads anywhere.

Loading…
JSON → XML element rules
Explains how objects, arrays and special characters are written as XML elements.

Developer notes

Every document gets an XML declaration and a root element named root. Keys become child elements, never attributes. Array items are named after the parent key without its last letter, plus _item, and the parent tag is dropped. So servers gives server_item. Use plural key names. Keys that are not valid XML names are cleaned. Other characters become an underscore, and a name that starts with a digit gets an underscore in front. A null value becomes an empty element. Namespace declarations are not written, so add them by hand if your schema needs them.

Use cases

Feed a JSON catalog into XML-only middleware. Generate fixtures for a parser test. Compare payloads before a partner integration.

About these options

For CSV output, choose the delimiter, how fields are quoted, the line endings and whether to write a header row. Auto uses a comma in English and a semicolon in French, German and Spanish, as Excel expects. For CSV input, the delimiter is detected on the first line (comma, semicolon, tab or pipe). You choose whether that line holds the column names. JSON output can use 2 or 4 spaces or a single line, with an optional recursive key sort. XML output can be pretty-printed with a chosen indent width. YAML output takes an indent width and a quoting mode for strings. XML comments are dropped, because the conversion goes through a JSON tree.

Examples

Nesting, booleans and escaped characters

Input

{ "service": { "name": "checkout-api", "enabled": true, "replicas": 2, "notes": null, "metadata": { "env": "prod", "owner": "Platform & Payments" } } }

Output

<?xml version="1.0" encoding="UTF-8"?> <root> <service> <name>checkout-api</name> <enabled>true</enabled> <replicas>2</replicas> <notes /> <metadata> <env>prod</env> <owner>Platform &amp; Payments</owner> </metadata> </service> </root>

Arrays become repeated item elements

Input

{ "cluster": { "name": "eu-west", "servers": ["srv-01", "srv-02"], "ports": [80, 443] } }

Output

<?xml version="1.0" encoding="UTF-8"?> <root> <cluster> <name>eu-west</name> <server_item>srv-01</server_item> <server_item>srv-02</server_item> <port_item>80</port_item> <port_item>443</port_item> </cluster> </root>

Related tools

Check the JSON first with the JSON validator, tidy it with the JSON formatter or compare it with a baseline using JSON diff. To go back, use XML → JSON, and shrink the JSON with the JSON minifier.

JSON → XML FAQ

What to expect

Is an XML declaration added?

Yes. The output starts with an XML declaration for UTF-8, followed by the root element.

Elements or attributes?

Keys always become child elements. The converter does not write attributes, so edit the XML by hand if your schema expects them.

How are special characters written?

The characters &, <, >, quotes and apostrophes are escaped as XML entities.

Is my data sent to a server?

No. The conversion runs in your browser, and FastMinify never receives what you paste.

Convert JSON to YAML, XML, CSV, TOML, TSV, SQL, HTML, Properties and INI. Every converter runs in your browser.