24 converter Units · Currency · Files

Convert JSON to XML JavaScript Object Notation ↔ Extensible Markup Language Free Online Secure

Drop your JSON file in and take away XML. It is read and written here, in your browser, so the file never leaves your device — and what the crossing keeps, and what it cannot, is written out below rather than left for you to discover.

Convert your file

Drop your JSON file here, or choose one.

Your file never leaves this device. Everything runs in your browser.

About this converter
What it keeps The whole tree. An object with a single key names the document after that key, so an XML file taken to JSON and back looks like itself; an array repeats its element; a key beginning with @ becomes an attribute.
What it cannot do Any JSON key can be a word; an XML element name cannot. A key that is not a legal name is not mangled into one — it becomes an <item name="…"> so the original is still in the file and still findable. Nothing is namespaced, and nothing is given a schema: the result is well-formed, not validated.
Where it runs In your browser. Nothing is uploaded, so there is nothing to delete afterwards.

Nothing uploaded

Where these formats come from

CSV is the oldest and the least standardised: a table written as lines of text, in use since the 1970s and only described in writing in 2005, by which time every program had already decided for itself what the separator was and when to put quotation marks. XML grew out of SGML in 1998 for documents that must carry strict structure and be checked against a schema. JSON was pulled out of JavaScript by Douglas Crockford around 2001, deliberately stripped down to objects, arrays, numbers and strings — and that minimalism is why it took over the web. YAML is its readable cousin, where indentation does the work that brackets do elsewhere. The one thing that matters when converting between them: CSV is flat, a grid of rows and columns, while JSON, XML and YAML are trees.

Where you meet them

CSV is what a spreadsheet exports and what an accountant, a shop platform or a bank statement will hand you. JSON is what web services speak and what configuration files are increasingly written in. XML survives in older enterprise systems, in invoicing standards and inside the office formats themselves. YAML is where humans write settings by hand. Converting between them is the daily work of moving data from where it was produced to where it is needed.

Questions people ask

My CSV opened as one column in Excel. Why?

Because your spreadsheet expected a different separator. Excel follows the list separator of the computer's regional settings, which is a semicolon anywhere the comma is already the decimal mark — that is, most of continental Europe. A file separated by commas then looks like a single column of text. Use the import dialogue and state the separator explicitly, rather than double-clicking the file. The same regional setting is why 3.5 sometimes arrives as a date.

Why can't my nested JSON become a tidy spreadsheet?

Because a spreadsheet is flat and JSON is a tree. A row can hold one value per column; a JSON object can hold a list inside a field inside another list. Converting means choosing how to flatten that: either joining nested names into one long column heading, or repeating the parent row once for each child. Both are compromises, and neither can be undone automatically — which is why going back from the spreadsheet to the original shape usually needs a human decision.

Does the file lose quality?

It depends on what the two formats can hold. Converting between formats that store the same thing — a PNG to a BMP, a WAV to a FLAC — loses nothing. Converting into a format that throws information away to save space, such as JPEG or MP3, loses a little every time, and converting back does not bring it back. Where a choice exists, this page errs towards keeping the original quality rather than making the smallest file.

Is my file uploaded anywhere?

No. The conversion happens inside your browser, on your own machine; the file never leaves it and there is no server here that could receive it. That is why a large file is limited by your own memory rather than by an upload, and why nothing you convert can appear in anybody's logs — including ours. The audio and video tools do fetch their conversion engine from this site the first time you use them, some thirty megabytes once; after that the work still happens entirely on your machine.

Why people convert JSON to XML

JSON is the language of modern web code: light, readable and understood by every programming language. XML is the older and more formal sibling, written in tags that open and close, and it is still the required format in a surprising number of places. Accounting programs, tax and customs systems, public procurement platforms, product feeds, publishing workflows, enterprise software and a long list of older web services all expect XML. When your data is in JSON and the system that must receive it speaks XML, a conversion is needed. That is why people convert JSON to XML: they have the information in one form, and the destination demands the other.

The situations are common. A developer who must send data from a modern application to a service built years ago. A shop that exports products as JSON and must hand a feed to a marketplace that wants XML. A team that needs a configuration in the markup form that a tool prefers. A student who wants to see how the same data looks in both notations. In every case the content is ready, and only the notation differs.

This page converts JSON to XML in your browser. Your file is read and written here, so it never leaves your device, which matters for orders, invoices and anything else private. And the page tells you in advance what the crossing keeps and what it cannot, rather than leaving you to discover it. Below you will find how the conversion works, how names, lists and attributes are treated and what to do about keys that XML cannot accept.

How the conversion works

The whole tree is carried over

Your JSON file is read inside your browser, and the whole tree is written out as XML. Objects become elements, their keys become the names of child elements, and values become the text inside. Nesting in the JSON is nesting in the XML, so the shape you see in braces is the shape you get in tags.

The document is named after the single key

An XML document needs exactly one root element. If your JSON object has a single key, that key names the document. This is the convenient case: an XML file taken to JSON and back looks like itself, because the root element becomes the single key and returns as the root element. If your JSON has several keys at the top, the converter wraps them in a root element so that the result is well formed.

Lists repeat the element

An array repeats its element. A key products holding a list of three records gives three product elements one after another, which is how XML expresses a list. The order is preserved.

What is kept

The whole tree

Every object, every list and every value is carried over. Nothing is dropped, and the nesting is the nesting of the original.

Attributes, through the @

A key beginning with @ becomes an attribute. A record with a key @id and a key name gives an element with an attribute id and a child element name. This is the same convention that the opposite conversion uses, so XML taken to JSON and back keeps its attributes.

The order

Keys keep the order in which they appeared in the JSON, so the elements in the XML follow the sequence of the source.

What you should know before you convert JSON to XML

Any JSON key can be a word; an XML name cannot

Any JSON key can be a word, a number or a phrase with spaces. An XML element name cannot: it must begin with a letter or an underscore and may contain letters, digits, hyphens, underscores and points, but no spaces. A key that is not a legal name is not mangled into one. It becomes an item element with a name attribute, written as item name="the original key", so the original is still in the file and still findable. Nothing is silently renamed.

Nothing is namespaced, nothing has a schema

Nothing is namespaced, and nothing is given a schema. The result is well formed, not validated. It will be read by any XML reader, but whether it satisfies the particular structure that a tax system or a marketplace requires is a separate question, and one that only the receiving party can answer. If a schema demands certain element names, you will need to make the JSON keys match them beforehand.

Values are text

XML has no types: every value in the tags is text. Numbers, true, false and null are written as their text. The program that reads the XML must interpret them as it sees fit.

How to convert JSON to XML here

Add your file

Drop the JSON file onto the page or pick it from your device. It is read inside your browser and is not uploaded.

Convert

Press the button. A file of ordinary size takes a moment. Leave the page open until it is done.

Download and check

Download the XML and open it in a text editor or a browser. Look at the start and the end, and check that the element names are what you expect and that attributes appear where you intended.

A closer look at JSON and XML

Two ways of writing a tree

Both JSON and XML describe a tree of values. JSON writes it with braces and brackets, and knows only objects, lists, strings, numbers, booleans and null. XML writes it with tags that open and close, and adds attributes, namespaces and mixed content. They overlap well for data, such as records and settings, and overlap poorly for documents, where text and markup are interleaved.

Why the conventions matter

JSON has no attributes, no root element and no concept of repeating an element. So any conversion needs conventions: the @ for attributes, the single key for the root, the repetition of elements for lists. The conventions used here are simple and consistent, and they match the ones used when going from XML to JSON, which is what allows a round trip to work in the common cases.

Empty values

An empty string and a null both end up as an empty element. If the difference matters to the receiving system, mark it in the data before you convert JSON to XML, for example with a separate flag.

Common situations in detail

Feeds for marketplaces and comparison sites

Many platforms ask for product feeds in XML. If your shop software exports JSON, convert JSON to XML, check the element names against the platform's specification and upload.

Older services and enterprise systems

Systems built in the era of SOAP and early APIs expect XML. A modern application can produce JSON and have it converted for them.

Configuration for tools that prefer XML

Some build tools, content systems and desktop programs read their settings from XML. A configuration written as JSON can be turned into the form they need.

Learning and comparing

Seeing the same data in both notations is a good way to understand how they differ. Paste a small JSON, convert it and compare the two side by side.

Practical advice before you convert JSON to XML

Check that the JSON is valid

A stray comma or a missing quote will stop the conversion. If the page reports an error, open the file in an editor that highlights JSON problems and fix the line it points to.

Make the keys legal element names

If you know the XML will be checked against a schema, use keys that are valid names and that match the schema. Otherwise the converter will keep them safe as item elements, which is correct but may not be what the receiver expects.

Choose a single top-level key

If you want the root element of your XML to have a particular name, wrap your data in an object with that one key before you convert JSON to XML.

Large files

Everything runs on your device, so a very large file needs memory. For files of many megabytes, use a computer, and split the data if the page struggles.

Questions people ask before converting

What names the root element?

An object with a single key names the document after that key.

How do I get an attribute?

Begin the key with an @. It becomes an attribute of the element.

What happens to a key with a space in it?

It is not a legal element name, so it becomes an item element with a name attribute holding the original key. Nothing is lost.

Will the XML pass a schema check?

The result is well formed, not validated. Whether it meets a given schema depends on your element names and structure.

Is my file uploaded?

No. The conversion runs in your browser and the file never leaves your device.

Can I go back to JSON?

Yes. XML to JSON reads an XML tree back, with the same conventions for attributes.

Choosing wisely when you convert JSON to XML

Is XML really needed?

If the receiving system accepts JSON, use JSON. Convert only when XML is required.

Other targets

For configuration that people edit, JSON to YAML reads more comfortably. For tables, JSON to CSV and JSON to XLSX serve spreadsheets.

Keep the JSON

The JSON is the master. It holds the types. Keep it, and treat the XML as a copy made for a particular receiver.

Getting a good result after the conversion

Open it in a browser

A browser shows XML as a collapsible tree. Open the file and expand the elements. If the structure looks like what you expect, it is sound.

Compare a few records with the source

Take a few records in the middle and check them against the JSON. It takes a minute and tells you the conversion is faithful.

Add what the receiver needs

If the receiver asks for a declaration line, a namespace or a stylesheet reference, add them in a text editor. They are not part of the data and are not written for you.

Preparing your JSON so that it converts well

Use regular structures

When you convert JSON to XML, regular data converts best: lists of records that share the same keys, each key a legal name. Irregular data produces a correct but untidy result.

Decide what is an attribute

Identifiers, codes and flags are often attributes in XML. Mark them in the JSON with an @, and the result will look like the XML that a human would write.

Test with a small piece first

If your file is large, take the first records into a test file and convert that. A quick look at the result shows whether the shape is what you expect.

Making the XML fit its receiver

Look at the specification first

Before you convert JSON to XML for a marketplace, a tax portal or a partner, read what they ask for. Most publish a description of the elements they expect, their order and which are required. Aligning your key names with it costs a few minutes in the JSON and saves a failed upload later.

Order can matter

Some XML schemas require elements in a fixed order. The converter keeps the order of your keys, so if the receiver insists on a sequence, write the JSON keys in that sequence. The result follows exactly what you wrote.

Add the declaration if it is required

A line at the top stating the version and the encoding is customary and some receivers insist on it. It is not part of the data, so it is not written for you. Add it by hand in a text editor, before the first element.

Mind special characters

Ampersands, angle brackets and quotation marks inside values are written in their escaped forms, so the XML stays valid whatever the text contains. You do not need to prepare them in the JSON.

Keep a sample that was accepted

Once the receiver accepts a file, keep a copy of that exact file and of the JSON that produced it. When a later upload fails, comparing it with the one that worked finds the difference at once.

Repeat the conversion rather than edit by hand

When the data changes, change the JSON and convert JSON to XML again. Editing the XML by hand leaves two versions that drift apart.

Privacy and handling

Why local conversion matters for data

Data files often hold what is private: customers, orders, invoices, settings. Many online converters upload your file to a server, process it and send back the result, and for a while a copy lives on a machine you do not control. Here your own browser does the work, so the data stays on your device.

What happens when you leave

When you close the page, the converted file disappears from the browser, so download it first. Nothing about your data is kept.

If something goes wrong

The page says the file is not valid JSON

There may be a stray comma, a missing quote or a bracket that does not close. Open the file in an editor that highlights JSON errors and fix the line it points to.

The receiver rejects the XML

The result is well formed but not validated. Compare it with the specification of the receiver and adjust the key names and the structure of the JSON.

The page freezes with a large file

Everything runs on your device, and a large file needs memory. Try again on a computer, or split the data.

Related tools

The same family of tools covers the neighbouring jobs. To go back, use XML to JSON. For configuration files, JSON to YAML and YAML to JSON convert between those two. For tables, there are JSON to CSV, CSV to JSON, JSON to XLSX and XLSX to JSON.

A worked example

Say your shop software exports 300 products as JSON, and a marketplace asks for an XML feed with a root element named catalogue. You wrap your list in an object with the single key catalogue, drop the file here and press the button. A moment later you download an XML whose root is catalogue and which holds 300 product elements, each with its id as an attribute because you wrote the key as @id. You upload the feed, and the marketplace accepts it. The JSON stays in your folder as the source.

A short checklist

Before converting

Check that the JSON is valid. Choose the root name. Mark attributes with @. Keep the JSON.

While converting

Stay on the page until the file is ready.

After converting

Open the XML, check the element names, attributes and lists, and test it with the receiver.

Common mistakes

Assuming the result is validated

The XML is well formed, not checked against any schema. Validate it against the receiver's rules.

Using keys with spaces or symbols

They become item elements with a name attribute. Use legal names if the receiver expects them.

Deleting the JSON

Keep it. It holds the types that XML cannot.

Your data stays on your device

The conversion happens locally. Your file is read by your own browser, rewritten there and handed back as XML. Nothing is uploaded, so no copy ends up on a server and nobody else can read it. For data with private content, that is the safe way to convert JSON to XML.

Summary

To convert JSON to XML here, drop the file and press the button. It is read and written in your browser, so the file never leaves your device. The whole tree is kept. An object with a single key names the document after that key, so an XML file taken to JSON and back looks like itself; an array repeats its element; a key beginning with @ becomes an attribute. Any JSON key can be a word; an XML element name cannot. A key that is not a legal name is not mangled into one: it becomes an item element with a name attribute, so the original is still in the file and still findable. Nothing is namespaced, and nothing is given a schema: the result is well formed, not validated.

Length & area Mass & volume Temperature Currency