Conversion is the easy part. You paste JSON into a converter, download an XML file, and the file looks plausible: nested tags, tidy indentation, nothing obviously broken. Then the receiving system rejects it, or worse, accepts it and quietly stores the wrong shape. The failure is rarely dramatic. It is a renamed element, an attribute that landed as a child element instead, or one array item that never made the trip.
A five-minute structural check catches nearly all of that before the file leaves your hands. This guide gives you the checklist, using the free JSON to XML Converter on Ovatly as the working example. The converter applies one deterministic mapping, which is exactly what makes checking possible: you know the rules the output should follow, so you can verify that it followed them.
Contents
- Quick answer
- The mapping you are checking against
- The pre-send checklist
- Worked example: the person record
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
- References
Quick answer
Before sending converted XML on, check five things against the original JSON: the tags balance when you scan the file by eye, every array item appears as a repeated element, every key that started with @ appears as an attribute rather than a child element, special characters in values appear in escaped form, and the root element carries the name you chose. Then look for renamed keys: characters that are invalid in XML names are replaced with underscores, and keys starting with a digit gain an underscore prefix. The JSON to XML Converter guarantees one consistent dialect, not the receiving system's schema, so this check is structural: it proves the conversion kept everything, not that the receiver will accept the shape.
The mapping you are checking against
You cannot check output against rules you do not know, so here is the whole mapping in one place. Keys become elements. A key starting with @ becomes an attribute of its parent element instead of a child element. The special key #text becomes the text content of its element. An array becomes a repeated element, one per item. A null becomes an empty element. You choose the root element name yourself. Two adjustments happen silently: characters that are invalid in XML names are replaced with underscores, and a key that starts with a digit gets an underscore prefix so the name stays legal. Special characters inside values are escaped.
Every item on the checklist below is one of these rules, verified. If a rule was broken, the file is wrong no matter how neat it looks.
The pre-send checklist
Work through the downloaded converted.xml with the original JSON open beside it.
- Scan for balanced tags. Read down the file and confirm every opening tag has its closing partner at the same nesting level. The converter produces balanced output, so an imbalance usually means the file was edited or truncated after download.
- Count the arrays. For each array in the JSON, count its items, then count the repeated elements in the XML. Two items in an array named
tagshould appear as two<tag>elements. A mismatch means something was dropped or merged. - Check the attributes. Every @ key in the JSON should appear inside its parent element's opening tag as an attribute, not as a child element further down. An
@idthat shows up as an<id>element is the single most common conversion surprise. - Check
#textand nulls. Where the JSON used#text, the value should sit directly inside its element as text. Where the JSON had a null, expect an empty element, present but holding nothing. Both are easy to mistake for missing data if you do not know to look for them. - Confirm the root name. The root element carries the name you chose at conversion time. If the receiving system expects a specific root, this is the cheapest mismatch to fix and the most embarrassing to ship.
- Hunt for underscores. Search the file for element names that differ from your JSON keys. A key with a space or a dash, or one starting with a digit, will have been renamed with underscores. Note each rename: the receiver may be looking for the original name.
- Expect escaped characters. A value containing an ampersand or angle brackets will appear in escaped form. That is correct behaviour, not corruption, and un-escaping it by hand would break the document.
Worked example: the person record
Take this JSON record, with an attribute, a plain value and a two-item array:
{"person":{"@id":"7","name":"Ana","tag":["a","b"]}}
Converted with the JSON to XML Converter, the output reads:
<person id="7">
<name>Ana</name>
<tag>a</tag>
<tag>b</tag>
</person>
Now run the checklist. Tags balance: <person>, <name> and both <tag> elements all close. The array count matches: two items, two <tag> elements. The attribute check passes: @id appears as id="7" inside the <person> tag, not as a child element. The root is person, the name chosen. There are no underscores to hunt for, because every key was already a legal XML name, and no special characters needed escaping. This file is structurally complete and ready to send.
Limitations and honest tradeoffs
The honest point of this whole guide: the converter guarantees its own consistent dialect, not the receiver's schema. A system that expects a specific namespace, a fixed element order, attributes where you placed elements, or a schema-specific structure may still reject a file that passes every check above. The checklist proves the conversion lost nothing and followed its rules. Whether the rules match the destination is a separate question, and if the receiving system publishes a schema or a sample file, comparing against that sample is the final step no converter can do for you.
The conversion also runs fully in your browser. Nothing is uploaded, which is good for privacy, but it means there is no server-side validation standing between you and the send button. The check is yours.
Common mistakes
- Sending the file unread. The download looks tidy, so it ships. Most conversion defects are visible in thirty seconds of scanning.
- Treating an attribute as missing. It is usually present, but as an attribute inside the opening tag, where a quick skim for child elements will not find it.
- Fixing escaped characters. Replacing the escaped form of a value with the raw character breaks the document. Escaping is the correct output.
- Missing the renames. A key starting with a digit or containing an invalid character comes out with underscores. If the receiver looks up the original name, it finds nothing.
- Assuming a passed check means schema acceptance. Structure and schema are different promises. This checklist covers the first one only.
FAQs
What does checking converted XML actually prove? It proves the conversion is structurally complete: every key, value, attribute and array item from the JSON has a counterpart in the XML, and the tags balance. It does not prove the file matches the receiving system's schema, because the converter produces one consistent dialect rather than a schema-specific format.
Why do some of my element names have underscores? XML names cannot contain certain characters and cannot start with a digit. The converter replaces invalid characters in a key with underscores and prefixes digit-leading keys with an underscore, so a key like 2fa becomes _2fa. Check for these renames before sending, because the receiving system may expect the original names.
How do I check that nothing was lost in conversion? Count both sides. Each item of a JSON array should appear as a repeated element in the XML, each @ key should appear as an attribute, and each null should appear as an empty element. If the counts match and the values read the same, nothing was dropped.
What happens to special characters in my values? They are escaped in the output, so a value containing an ampersand or an angle bracket is written in its escaped form and cannot break the document. When you check the XML, expect to see the escaped form rather than the raw character.
Is my JSON uploaded to a server during conversion? No. The conversion runs fully in your browser, and the JSON never leaves your device. That also means the check is yours to do: nothing on a server validates the result before you send it on.
Conclusion
Converted XML deserves the same scepticism as any hand-edited file: five minutes, six checks, and you know the conversion kept every value and followed its mapping. The JSON to XML Converter makes that check easy precisely because its rules never change. When the data flows the other way, from an XML file into a JSON API, our guide on converting an XML file to JSON for a modern API covers the shape rules in that direction. For more guides in this series, see our Data and JSON Tools guides.
References
- W3C, the Extensible Markup Language (XML) specification, on names and well-formedness: https://www.w3.org/TR/xml/
- MDN Web Docs, on XML introduction and naming rules: https://developer.mozilla.org/en-US/docs/Web/XML/Guides/XML_introduction