Skip to main content
WizTools123
Free Online Tools

Tool Categories


Developer Tools New Tool

Free Online JSON to XML and XML to JSON Converter

Turn JSON into XML with a root element you name and a name for array items, or read XML back into JSON with attributes kept under a prefix and text under its own key. Repeated elements become arrays, illegal element names are reported, and it all runs in your browser.

JSON And XML Both Ways You Name The Root Line And Column Errors Nothing Uploaded
Free Online JSON to XML and XML to JSON Converter
Share this tool
JSON & XML Converter Everything happens in this tab. Nothing you paste is sent anywhere.
Your document
Result
Direction
Writing the XML
Reading the XML

Converted.

root - 0 elements 0 attributes 0 bytes out

Buy Us A Coffee

Enjoying WizTools123? Help keep our server infrastructure 100% free and open for everyone.

Buy Us A Coffee

How to Use JSON and XML Converter

Step by step, start to finish.

1
Paste JSON or XML

Whichever you have. Press Sample to load an example of the direction you are in. Nothing is uploaded.

2
Pick the direction

JSON to XML, or XML to JSON. The options change, because each direction needs different questions answered.

3
Name things

Going to XML, set the root and the array item name. Coming back, set the attribute prefix and the text key.

4
Read the notes and copy

Any key that had to be renamed to be legal XML is reported above. Then copy, download, or send the result back as input.

Key Features

What this tool does, and what it does not do.

Both directions

JSON to XML and XML to JSON, each with its own options.

You name the elements

The root and the array item name are yours, not a hardcoded guess.

Attributes handled

Written from simple values on the way out, kept under @ on the way in.

Names made legal, and said so

Keys that cannot be XML names are corrected and every change is listed.

Errors with a position

A line and a column from the parser, for either format.

Nothing uploaded

SOAP payloads hold real data. Parsing happens in your tab.

About JSON and XML Converter

XML and JSON are both here to stay, which means converting between them keeps coming up. Banking, government, healthcare, shipping and telecoms interfaces are largely XML, while anything written for the web in the last fifteen years speaks JSON. Sooner or later something you own has to talk to something on the other side.

This page converts either way in your browser. Going to XML you choose the root element name, the name given to array items and whether simple values are written as attributes or as child elements; escaping and name sanitising are handled, and any name that had to change is reported. Coming back, attributes are collected under a prefix you choose, text content goes under its own key, repeated siblings become an array, and you decide whether a single child should be an array too.

The interesting part of writing this was refusing to pretend the mapping is clean. XML carries attributes, namespaces, comments and meaningful ordering; JSON carries types, arrays and nulls. Neither can hold the other in full, so rather than quietly picking conventions the page puts the naming decisions in front of you and states plainly what is lost each way. A converter that hides that is the reason people find surprises in production.

Frequently Asked Questions

Common questions about this tool.

Because JSON has no concept of an attribute, so something has to distinguish the attribute id from a child element also called id. Prefixing attribute names with @ is the most widely used convention, and it is what most XML to JSON libraries do. You can change the prefix, or set it to nothing if you know your document has no such collisions.

Because nothing in the XML says it is a list. A single <line> element and a list containing one line look exactly the same in XML, and only the schema knows which was meant. By default a single child becomes a plain value; turn on the single child switch and every repeatable element becomes an array, which is usually what you want when the consumer expects a fixed shape.

They are flattened. An element written as soap:Envelope becomes the key "soap:Envelope", and the xmlns declarations arrive as ordinary attributes. JSON has no namespace mechanism, so the prefix is kept as part of the key name, which keeps every element and every declaration visible in the result. Keep the original XML alongside if you will need to rebuild the exact namespace bindings later, because the JSON records the names rather than the bindings.

Because XML has no types. Everything between tags and inside attributes is text, and only a schema can say that a particular element holds an integer. Rather than guess, values are kept as strings. If you need real numbers afterwards, the CSV and JSON converter has a typing option, or you can cast the fields you know about in code.

No. Both parsers run in your browser, and the page makes no network requests at all, which also means a DTD or schema referenced in your document is never fetched. XML is often an invoice, a SOAP envelope or a bank message, so keeping it in the tab matters.

More Developer Tools

Other tools from the same hub, free and in your browser.

All Developer Tools

Feedback

No feedback on this tool yet. Yours would be the first.