Ready now
XML <-> JSON Converter
Preparing controls…
About this tool
What XML <-> JSON Converter does
Convert XML documents to JSON or JSON values to XML, with readable local output for data exchange and debugging.
Map XML elements into JSON objects, or build XML from a JSON object with one root key. Attributes use an @_ prefix and element text uses #text so the mapping is visible.
Keep an attribute distinct from text
Input or settings
<item id="7">Ada</item>
Expected result
{
"item": {
"#text": "Ada",
"@_id": "7"
}
}How to use it
- Choose a conversion direction and paste a small document.
- Choose Convert, then inspect attributes, element text and repeated elements.
- For JSON to XML, provide exactly one root key and check the resulting XML.
Common uses
- Inspect an XML payload using familiar JSON structure.
- Prepare a simple structured document for an XML-only workflow.
Important limitations
- Document type declarations are rejected; the tool does not fetch external entities.
- XML comments, mixed-content ordering and other document features do not form a universally lossless JSON round trip.
Frequently asked questions
Why does an attribute become @_id?
The prefix separates attributes from child elements with the same name. Preserve it when converting the mapped JSON back to XML.
Why must JSON have one root key?
An XML document needs one root element. Wrap the intended children under a single named key.