JSON to XML Converter
Convert JSON objects and arrays to well-formed XML. Maps object keys to elements, array items to repeated elements, with optional root wrapper.
How to use the json to xml converter
Paste JSON on the left. Well-formed XML appears live on the right. Object keys become element names; nested objects become nested elements; array items become repeated elements.
Formula & explanation
We map { key: value } to <key>value</key>. Arrays render as repeated elements. Keys starting with "@_" become attributes on the parent (matches fast-xml-parser's convention).
Examples
{"book":{"@_id":"1","title":"Demo"}} becomes <book id="1"><title>Demo</title></book>
Frequently asked questions
- How do I produce attributes instead of child elements?
- Prefix the key with @_ — e.g. {"book": {"@_id": "1", "title": "x"}} produces <book id="1"><title>x</title></book>. This matches the fast-xml-parser convention.
- What if my root is an array?
- XML requires a single root element. We wrap arrays in <root><item>…</item></root> automatically. Wrap them yourself in a named root if you want a specific element name.
- Are XML namespaces supported?
- Yes — include them as attributes (e.g. "@_xmlns": "http://example.com"). The output is namespace-aware but we don't auto-generate prefixes.
Related developer tools tools
- XML to JSON ConverterConvert XML to JSON for legacy API integration, SOAP responses, and config migration. Handles attributes, namespaces, and text content.
- JSON DiffCompare two JSON values semantically. Ignores key order; shows added, removed, and changed fields with their JSONPath — great for diffing API responses and config files.
- JSON to CSV ConverterConvert JSON arrays to CSV with automatic header detection from object keys. Handles nested values and arbitrary delimiters.
- XML to CSV ConverterFlatten repeated XML elements into CSV rows with attributes and child text as columns. Great for opening XML data in Excel or Sheets.
- CSV to JSON ConverterConvert CSV to a JSON array of objects. Uses the first row as keys, handles quoted values, and detects common delimiters automatically.
- CSV to XML ConverterConvert CSV rows into XML elements with column headers as tag names. Useful for Excel exports, legacy systems, and ETL pipelines.