JSON to XML Converter – Keys Become Elements | MiConvert

JSON to XML Converter

Upload a JSON file and get an XML document wrapped in a single element named root, with each key turned into a child element and each array written as that element repeated. Everything becomes element text: no attributes are generated, and numbers and booleans lose their type.

📁

Drop your file here

or click to browse

Select File

Max 10 files, 50MB each

SSL Encrypted Auto-deleted No Sign Up 100% Free
JSON → XML

How JSON maps to XML here

JSON and XML both describe nested data, but many systems accept only one of them. SOAP web services, older ERP and banking imports, feed formats and many configuration files expect XML. The data you have, though, may have come from a REST API or a JavaScript app as JSON. Renaming the file changes nothing: the braces and brackets have to be rewritten as tags.

The converter parses your file as strict UTF-8 JSON on our server. It writes an XML document that starts with a declaration giving XML version 1.0 and UTF-8 encoding, and places everything inside one element named root, because XML allows only one top-level element. Each object key becomes an element, and nested objects become nested elements, keeping the original nesting depth. An array is written as the same element repeated once per item. If the JSON itself is an array, its entries appear as item elements inside an items element. The characters & and the angle brackets, double quotes and apostrophes are escaped in text, and a null value becomes an empty self-closing element, so a null middleName key comes out as an empty middleName element.

XML is stricter about names than JSON. Characters that are not allowed in an element name, such as spaces, @ or $, are replaced with an underscore. A key that begins with a digit gets an underscore in front, so a key named 2024 total turns into an element named _2024_total. If the receiving system expects exact tag names, rename those keys in the JSON before converting.

Some things have no direct equivalent and are dropped. No attributes are produced. Conventions such as @id or #text, used by libraries like xmltodict and Json.NET, are treated as ordinary keys and come out as element names with underscores. Numbers, booleans and nulls all become plain text, so the output carries no type information, and the root element is always named root. Converting the result back with our XML to JSON tool will not restore the original structure either, because that parser flattens nested elements.

This tool is useful for a quick look at how a payload reads as XML, for feeding a test record into a SOAP or legacy import, or for anyone who needs one file converted without writing code. Production integrations, for example in SAP Cloud Integration (CPI), Java or C#, are better served by the platform's own converter, where the mapping is configurable.

How to convert JSON to XML

  1. Validate the JSON first. The strict parser rejects comments, trailing commas, single-quoted strings and files with one object per line.
  2. Review your key names. Keys with spaces, symbols or a leading digit will be rewritten with underscores, so rename them now if exact tag names matter.
  3. If the target system needs a specific root element or wrapper names, plan to rename the root, items and item elements after converting. They cannot be set on this page.
  4. Upload the .json file and convert it. Even multi-megabyte files have typically finished within a few seconds after the upload.
  5. Download the .xml file. If the receiving system has a schema, validate the file against it before importing.

What the JSON to XML converter does

  • Adds a UTF-8 XML declaration and a single wrapper element named root to every output
  • Turns nested objects into nested elements, keeping the original nesting depth
  • Writes arrays as repeated sibling elements; a top-level array goes under an items element, with one item element per entry
  • Escapes ampersands, angle brackets, double quotes and apostrophes in text
  • Writes null values as empty self-closing elements
  • Replaces characters that are illegal in XML names with underscores instead of producing a broken document

Video Tutorial

Watch this step-by-step tutorial to learn how to convert JSON files to XML format online for free using MiConvert.com. No software installation required.

JSON to XML questions

Can I choose the root element name or the formatting?

No. The converter has no settings: the root element is always named root, and there is no indentation option. To use a different root name, edit the first and last tags in any text editor. To pretty-print the file, run xmllint --format file.xml on Linux or macOS, or use the pretty-print command of the XML Tools plugin in Notepad++.

Will any JSON keys become XML attributes?

No. Every key becomes a child element, and no attributes are created. Keys written in attribute conventions such as @id are not interpreted; the @ is replaced, so the key becomes an element named _id. If your target format needs attributes, add them afterward with an XSLT transform or in code.

How are arrays converted?

Each array item becomes its own element named after the array's key. For example, {"tags":["red","blue"]} becomes two tags elements inside the root, one holding red and one holding blue, and the key is not singularized. When the whole file is an array, the converter writes an items element inside root and puts each entry in its own item element.

What does "Unexpected end of JSON input" mean?

Your file stops before the JSON is complete: a closing brace, bracket or quote is missing, or the file is empty. This usually means an interrupted download or an incomplete copy from an API console or log. Get a complete copy of the file, check that the last character closes the outermost structure, and validate it before trying again.

Why are some of my tag names different from my JSON keys?

XML element names cannot contain spaces or most symbols and cannot start with a digit. The converter replaces those characters with underscores and puts an underscore before a leading digit, so the document stays parseable. To control the final names, rename the keys in the JSON before uploading.

How do I convert JSON to XML in Python, Java, C# or SAP CPI?

In Python, the xmltodict package's unparse function converts a dict that has exactly one top-level key. In Java, org.json's XML.toString takes a JSONObject. In C#, Newtonsoft.Json offers JsonConvert.DeserializeXmlNode(json, "root"). In SAP Cloud Integration, add the JSON to XML Converter step to the integration flow.

Do I have to pay, and are there size limits?

You can convert without an account at no cost for files up to 50 MB, with up to 10 conversion jobs per hour per IP address. Signing in lifts the file limit to 100 MB, and the Plus and Pro plans lift it to 200 MB and 1 GB. Data files larger than your plan allows cannot use the pay-once large-file service, so split them first.

Is my JSON stored or shared?

Files reach our server over HTTPS, and the uploaded JSON is removed when the conversion finishes. The XML stays available for roughly 4 hours, then it is deleted automatically, and nothing is published or listed anywhere. The download link is a long random token, but it is not one-time, so treat it like the file itself. File names and conversion results appear in our service logs, and signed-in accounts keep a history row until the account is deleted.