JSON to XML Converter
Paste JSON and get clean, well-formed XML instantly. Choose the root element name, map @ keys to attributes, decide how arrays are written, then copy or download the result. Nothing leaves your browser.
Advertisement
How to use the JSON to XML Converter
Paste your JSON into the left box, upload a .json file, or click Sample .Set the root element name. If your JSON has a single top-level key, it can be used as the root automatically.Choose how arrays are written : repeated elements with the key's name (<tag>a</tag><tag>b</tag>) or wrapped in a parent with item elements.Add attributes by prefixing keys with @, for example {"book": {"@id": "b1", "title": "…"}}.Copy or download the XML.
How JSON is mapped to XML
JSON XML
{"name": "Ann"}<name>Ann</name>
{"user": {"@id": 7, "name": "Ann"}}<user id="7"><name>Ann</name></user>
{"price": {"@currency": "EUR", "#text": 9.5}}<price currency="EUR">9.5</price>
{"tag": ["a", "b"]}<tag>a</tag><tag>b</tag>
{"tag": ["a", "b"]} with Wrap arrays <tag><item>a</item><item>b</item></tag>
{"note": null} or {"note": ""}<note/>
{"#cdata": "a < b"}<![CDATA[a < b]]>
{"#comment": "generated"}<!--generated-->
Numbers and booleans are written as text (44.95, true) because XML has no data types of its own; a schema (XSD) is what gives XML values a type. An empty array produces no element at all, since XML has no way to say "an empty list" without a wrapper.
Tips for clean XML
Pick meaningful names. Rename the root and array item elements to match your domain, for example catalog and book.
Use attributes for metadata such as IDs, units and language codes, and elements for the actual content.
Namespaces can be added with an attribute key such as "@xmlns": "urn:example" or "@xmlns:xsi".
Going the other way? Use the XML to JSON converter , and tidy existing XML with the XML Formatter .
Frequently asked questions
How does JSON map to XML? Each object key becomes an element, its value becomes the element's content, and nested objects become nested elements. Keys that start with @ become attributes, a #text key becomes the element's text, and null becomes an empty element such as <name/>.
How are JSON arrays converted to XML? By default every array item becomes a repeated element with the array's key as its name, so {"tag": ["a", "b"]} becomes <tag>a</tag><tag>b</tag>. Tick 'Wrap arrays' to get <tag><item>a</item><item>b</item></tag> instead. Arrays at the top level always use the item name.
Why does XML need a root element? A well-formed XML document must have exactly one root element. If your JSON is an array or an object with several top-level keys, the converter wraps everything in the root name you choose (default root).
What happens to keys that are not valid XML names? XML element names cannot start with a digit or contain spaces and most symbols. Such characters are replaced with underscores and names that start with a digit get an underscore prefix, for example "2024 sales" becomes <_2024_sales>. The status bar tells you how many names were changed.
Are special characters escaped? Yes. &, < and > are escaped in text, and quotes are escaped in attribute values, so the output is always well-formed. Control characters that XML 1.0 does not allow are removed.
Is my data uploaded? No. The conversion runs entirely in your browser with JavaScript, so your JSON is never sent to a server.
Related tools
XML to JSON Convert XML to JSON with validation. JSON Formatter Beautify, minify and validate JSON, with a collapsible tree view. XML Formatter Beautify, validate and minify XML with a collapsible tree view. JSON to YAML Converter Convert JSON to clean YAML as you type, with indent, quoting and sort options. QR Code Generator Make QR codes for links, Wi-Fi, email and more. Barcode Generator Create Code 128, EAN-13, UPC-A, EAN-8, Code 39 and ITF-14 barcodes as PNG or SVG. Password Generator Create strong passwords and passphrases. UUID Generator Generate UUID v4 and v7 / GUIDs in bulk and copy or download them. Hash Generator Generate MD5, SHA-1, SHA-256 and SHA-512 hashes of text or files. MD5 Hash Generator Generate MD5 hashes of text, lines or files and verify checksums. SHA-256 Hash Generator SHA-256 and HMAC-SHA256 hashes of text, lines or files, in hex or Base64. SQL Formatter & Beautifier Format, beautify or minify SQL queries for MySQL, PostgreSQL and more. JavaScript Beautifier Format and beautify messy or minified JavaScript, or minify it. HTML Formatter Beautify and indent HTML code with a live preview. CSS Formatter Beautify CSS with indent controls and optional property sorting. Base64 Encoder Decoder Encode or decode Base64 text and files, and make data URIs. URL Encoder Decoder Percent-encode or decode URLs, query strings and form data. HTML Entity Encoder / Decoder Escape and unescape HTML entities, named or numeric. JSON to CSV Convert JSON data to CSV for spreadsheets. CSV to JSON Convert CSV data to JSON with live preview. Excel to CSV Convert XLSX spreadsheets to CSV. Unzip Files Open and extract ZIP files online. RAR & 7z Extractor Open RAR, 7z and other archives online and extract files. ZIP File Creator Compress files and folders into a ZIP. Regex Tester Test and debug regular expressions live. CSV Viewer Open a CSV or TSV file as a sortable, filterable table. Excel Viewer (XLSX / XLS) Open XLSX, XLS and ODS spreadsheets in your browser without Excel. YAML Validator & Formatter Validate, format and minify YAML, and convert YAML to JSON or back. Bcrypt Hash Generator & Checker Create bcrypt password hashes and check a password against a hash. UTM Campaign URL Builder Add UTM tracking parameters to links and make a QR code. Schema Markup Generator (JSON-LD) Create JSON-LD structured data for FAQ, Product, Article and more. Htaccess & Nginx Redirect Generator Build 301 redirects for .htaccess, Nginx and Netlify or Cloudflare _redirects. Line Ending Converter Convert text and files between CRLF, LF and CR line endings. Meta Tag Generator Create SEO, Open Graph and X meta tags with live previews. Robots.txt Generator Build a robots.txt file with rules, sitemap lines and AI-bot blocking presets. Sitemap Generator Turn a list of URLs into a valid XML sitemap file. Open Graph Preview Paste OG tags and preview how links look on Facebook, X and LinkedIn. Markdown to HTML Convert Markdown to clean HTML with a live editor. Binary Translator Convert text to binary, hex, octal and back. Email Validator Check email lists and spot disposable addresses. Website Down Checker Check if a website is down for everyone. Fake Data Generator Generate mock data as JSON, CSV or SQL. File Info Viewer Check file size, type, date and MD5/SHA hashes. Text Encoding Converter Detect and convert text file encodings like UTF-8, UTF-16 and Latin-1. Deep Link Generator Create links that open directly in apps. JSON Viewer Explore JSON as a collapsible tree, search keys and values and copy any node's path. HTML Minifier Minify HTML: strip comments and whitespace safely and see how many bytes you save. HMAC Generator Generate and verify HMAC signatures with SHA-256, SHA-512, SHA-1 or MD5. URL Parser Break a URL into its parts and edit query string parameters with a live rebuild. SQLite Viewer Open .db and .sqlite files in your browser, browse tables and run SQL queries. CSS Minifier Minify CSS with csso or a built-in engine and see the size saved instantly. CRC32 Checksum Calculator Calculate CRC-32, CRC-32C, CRC-16 and Adler-32 checksums of text or large files. User Agent Parser See your user agent and parse any UA string into browser, OS, engine and device. YouTube Embed Code Generator Create responsive YouTube embed code with start time, autoplay, loop and privacy mode. DOCX Viewer Open and read Word .docx files in your browser, then print or save them as HTML. JavaScript Minifier Minify JavaScript with Terser: compress, mangle and see how many bytes you save. JWT Decoder Decode JSON Web Tokens, read the claims and expiry, and verify HS256 signatures. EPUB Reader Open and read EPUB e-books in your browser with pages, a table of contents and font controls. JSON Minifier Minify and validate JSON, sort keys and see exactly how many bytes you save. JWT Generator Create and sign HS256, HS384 or HS512 JSON Web Tokens in your browser and verify them. What Is My Browser See your browser, version, OS, engine, screen and which web features it supports. Font Viewer Preview TTF, OTF, WOFF and WOFF2 fonts with sample text, waterfall, glyphs and metadata. Markdown Editor Write Markdown with a toolbar, live split preview, autosave and .md or HTML export. Random String Generator Generate secure random strings and tokens in bulk with any length and character set. HTTP Status Codes Search every HTTP status code with plain-English meanings, causes, fixes and RFC references. TTF to WOFF2 Converter Convert TTF and OTF fonts to WOFF2 or WOFF and get a ready @font-face CSS snippet. Code Diff Checker Compare two code files side by side or unified, with syntax colors and changes highlighted. API Key Generator Create secure API keys and secrets with prefixes, checksums and SHA-256 hashes for storage. MIME Type Lookup Find the MIME type for any file extension, or the extensions for a MIME type, in 400+ entries. Cron Expression Generator Build crontab schedules visually, read them in plain English and see the next run times. Password Strength Checker See how strong a password really is, how long it takes to crack and how to improve it. Subnet Calculator Calculate IPv4 network, broadcast, host range, masks and host count, and split subnets. SERP Snippet Preview Preview your title tag and meta description with pixel-accurate truncation on desktop and mobile. Regex Cheat Sheet 75+ ready-to-use regex patterns for emails, URLs, IPs and dates, each with a live test box. Caesar Cipher Encode and decode Caesar shift ciphers and crack unknown shifts with a ranked brute force. IPv6 Expander & Compressor Expand IPv6 addresses to full form or compress them per RFC 5952, one or many at once. GraphQL Formatter Pretty-print and indent GraphQL queries, mutations and schemas, or minify them, instantly. Vigenère Cipher Encrypt and decrypt Vigenère and Autokey ciphers, and crack unknown keys with frequency analysis. Chmod Calculator Convert Linux file permissions between checkboxes, octal (755) and symbolic (rwxr-xr-x) notation. JSON to TypeScript Generate TypeScript interfaces or types from JSON, with nested types and optional fields. Morse Code Translator Translate text to Morse code and back, then play it as sound or a blinking light, or save a WAV. HTML Table Generator Build HTML tables in an editable grid with styles, header rows, CSV import and live preview. Atbash Cipher Encode and decode Atbash ciphers (A↔Z, B↔Y) in Latin or Hebrew, with a live letter mapping table. CSS Box Shadow Generator Design layered CSS box shadows with a live preview, presets and one-click Copy CSS. Bulk URL Opener Open a list of URLs in new tabs at once or in batches, with cleanup, dedupe and delay. Hex to Text Converter Convert hex to text and text to hex with UTF-8 support and space, 0x, \x or comma formats. CSS Border Radius Generator Round each corner, draw elliptical 8-value radii or random blob shapes and copy the CSS. Hreflang Tag Generator Create hreflang tags, sitemap entries and Link headers for every language and region, validated. ASCII Table Full ASCII code chart 0–255 in decimal, hex, octal, binary and HTML, with search and copy. CSS Button Generator Design CSS buttons with gradients, borders, shadows and hover and active states, then copy the code. Canonical Tag Generator Normalize URLs and create rel=canonical tags and HTTP headers, for one page or a whole list. Unicode Character Lookup Find Unicode characters by name or code point and copy them with UTF-8, HTML and code escapes. CSS Flexbox Generator Build flexbox layouts visually: set container and item properties, then copy the CSS and HTML. Twitter Card Generator Create X / Twitter Card meta tags with Open Graph fallbacks, character counters and a live preview. Punycode Converter Convert international domain names, emails and URLs between Unicode and xn-- Punycode, in bulk. CSS Grid Generator Draw CSS grid layouts: set tracks and gaps, drag to name areas, then copy the CSS and HTML. PX to REM Converter Convert px to rem or em and back, with a 1-100px table and a whole-CSS converter. YAML to JSON Converter Convert YAML to pretty or minified JSON, with errors pinned to the exact line. HTML to Markdown Converter Turn HTML or pasted rich text into clean Markdown with tables and live preview. Markdown Table Generator Build Markdown tables in a grid or paste from Excel/CSV, with alignment and preview. JSON Validator Check JSON with the exact line and column of each error, fix tips and one-click auto-fix. JSON Escape / Unescape Escape text for a JSON string, unescape \n and \" back to text, or stringify a whole object. URL Slug Generator Turn titles into clean, SEO-friendly URL slugs: accents, stop words, separators and bulk lines. JavaScript Keycode Finder Press any key to see its JavaScript key, code, keyCode, which, location and modifiers. Glassmorphism CSS Generator Design frosted-glass UI cards with blur, transparency and border sliders, then copy the CSS. CSS Text Shadow Generator Layer CSS text shadows with a live preview and neon, 3D, outline and retro presets. Image to Base64 Convert images to Base64 data URIs, CSS backgrounds and HTML img tags in your browser. Base64 to Image Paste a Base64 string or data URI to preview, identify and download the image. DNS Lookup Look up A, AAAA, MX, TXT, NS, CNAME, SOA and CAA records with TTLs over secure DNS. HTML Editor (Live Preview) Write HTML, CSS and JavaScript and see a live, sandboxed preview as you type. QR Code Scanner Scan QR codes with your camera or from an image and safely read the link or text. JSON Compare Compare two JSON documents and see every added, removed and changed path. Hex to Decimal Convert hex to decimal instantly with steps and signed mode. Decimal to Hex Convert decimal to hex instantly with steps and signed mode. Binary to Decimal Convert binary to decimal instantly with steps and signed mode. Decimal to Binary Convert decimal to binary instantly with steps and signed mode. Binary to Hex Convert binary to hex instantly with steps and signed mode. Hex to Binary Convert hex to binary instantly with steps and signed mode.
See All Developer Tools ▾