JSON to XML Converter
Convert between JSON and XML without either document leaving your browser.
Namespaces and custom mapping
These settings change how attributes, text and namespace prefixes cross between JSON and XML. The defaults match the mapping described above.
JSON
Colorazione sintattica disattivata.
XML
Colorazione sintattica disattivata.
Il risultato appare qui.
Funziona interamente nel tuo browser.
Su questo strumento
XML has no single mapping onto JSON, so this tool picks one and states it on the page instead of pretending there is a natural one. Writing, an object becomes an element per member and an array becomes repeated sibling elements under a root element whose name you choose, because JSON has nothing that names an object the way a root element does. A member name that is not a legal XML element name stops the conversion and is named. An attribute becomes a key prefixed with @ and text sitting next to child elements becomes a #text key, and neither @ nor # is a legal XML name character, so a JSON key can never collide with them. A null becomes an empty element, and so do an empty object, an empty array and an empty string, because XML has one shape for nothing and cannot tell them apart, so they all read back as null. Reading, every value is a string, because XML records no types and guessing them is how a postcode becomes a number. A repeated element name becomes an array. The reader handles comments, CDATA, entity references and a DOCTYPE, and reports anything else with its position. The attribute prefix, the text key and namespace handling are all configurable in Namespaces and custom mapping, for a document that uses a different convention.
Come usare
- Choose a direction, then paste your document into the left pane or load the sample.
- Press Convert. Writing, you can name the root element first.
- Copy the result or download it as a file.