JSON to XML converter

Paste JSON or open a .json file and get well-formed XML. Arrays become repeated elements, keys starting with @ become attributes, keys that aren't valid XML names (first name, 2fa) are fixed, and a root element is added when the JSON has more than one top-level key. Runs in your browser.

Open a file: (or drop it on this box)

 

     

How JSON maps to XML

An object with one top-level key uses it as the root element; anything else (several keys, a top-level array, a single value) is wrapped in a root element you can name. Arrays become the same element repeated ("tags": ["a","b"] gives two <tags> elements), a top-level array becomes <item> elements, and nested arrays get <item> children. Keys that start with @ become attributes and #text becomes the element's text, the same convention as our XML to JSON converter, so the two round-trip.

Names XML doesn't allow

XML element names can't contain spaces or start with a digit, so first name becomes first_name and 2fa becomes _2fa; the status line says how many keys were renamed. null and empty strings become empty elements (<note/>), empty arrays are dropped since XML has no way to write them, and <, & and quotes are escaped.

Render the result as a PDF or an image

Need the data as a document? The Shotmint API turns HTML into a PDF or PNG in real Chromium: POST https://shotmint.creasework.com/v1/pdf with {"html": "…"} returns a PDF, and /v1/screenshot returns a PNG of any page or HTML (1 credit each; 25 free renders a month, then €5 for 2,000 that never expire). Scripts, AI agents and Make or Zapier can get a key with a bare POST https://shotmint.creasework.com/v1/keys/free (no body, JSON reply); the request bodies are described in openapi.json.

Get 25 free renders a month API docs

FAQ

Is my file uploaded? No. Parsing and conversion run in your browser with js-yaml and fast-xml-parser; this page sends nothing to a server, so it works for secrets in config files.

Can it convert the other way? Yes: every page reads JSON, YAML and XML (detected automatically), and the "Convert to" menu picks the output, so it also converts XML to YAML or reformats a file in its own format. Related: JSON to YAML, YAML to JSON, XML to JSON, CSV to JSON, JSON to CSV, JSON to Excel.

Related tools

XML to JSON · XML formatter · Minify XML · XML Validator · CSV to JSON · YAML to JSON · JSON to CSV · JSON to YAML · JSON formatter · Excel to JSON Converter · JSON Diff · JSON to Excel Converter · JSON Validator · Minify JSON · all free tools