XML to JSON
An XML to JSON converter turns well-formed XML into a pretty-printed JSON object. This one parses with the browser DOMParser in your tab. Attributes become @keys, repeated sibling tags become arrays, and leaf text becomes a string. Nothing is uploaded or written to localStorage. It is a convenience converter, not an XSD validator and not a merge-PDF tool.
Updated
Paste or drop a .xml file, convert to pretty JSON in this tab, then copy or download .json. Closing the tab drops the buffer. Invalid XML gets an honest in-page error instead of invented output.
One canonical URL with a trailing slash and no /in/ prefix. Need the reverse? JSON to XML lives on its own page at /file-conversion/json-to-xml/ with the same @attr, #text, and repeated-tag conventions. India-first SAMPLE examples use city names; the same page works globally.
Paste XML (any well-formed tree). Drop a .xml file — it stays in this tab. Attributes become @keys; repeated tags become arrays.
Optional .xml drop. Read with FileReader in this tab — never uploaded.
JSON output
How does the XML to JSON work?
1. Paste or drop XML
Any well-formed XML document works. Dropped .xml files are read with FileReader in this tab — never uploaded.
2. Convert locally
DOMParser builds the tree in this tab. The root element becomes the top JSON key. Attributes use an @ prefix; repeated sibling tags become arrays; leaf text becomes a string value.
3. Read honest errors
Malformed XML shows a short parse error and leaves JSON empty. The page does not auto-close tags or invent a partial object. Nothing is sent to a server.
4. Copy or download
Copy the pretty JSON or download .json. Closing the tab drops the buffer.
Questions about XML to JSON
- Does XML to JSON upload my file?
- No. Parsing and conversion run in your browser with DOMParser. There is no account and no server-side converter. Dropped files are read with FileReader in this tab; we do not upload them to Page Utils or write them to localStorage. Closing the tab drops the buffer.
- How are attributes and repeated tags represented?
- Attributes become keys with an @ prefix (for example @id). When several sibling elements share the same tag name, they become a JSON array. A single child stays an object or string. Leaf elements with only text become a string value; mixed content can include a #text field.
- What happens if my XML is invalid?
- You get a short parse error next to the input and the JSON stays empty. The page does not auto-close tags or invent a partial object. Fix the XML in an editor and paste again — conversion stays in this tab and nothing is uploaded.
- Is there a JSON to XML reverse?
- Yes, on its own URL: /file-conversion/json-to-xml/ converts JSON back to indented XML using the same @attribute, #text, and repeated-tag conventions, so a document can round-trip. This page stays XML → JSON only — one canonical trailing-slash URL per direction.
- Is there an /in/ version for India?
- No. The same /file-conversion/xml-to-json/ URL works globally, including from India. We do not duplicate tools under a country prefix. SAMPLE examples may use Indian city names; the converter itself is format-agnostic.
- Will this replace an XSD validator or database import?
- No. It is a convenience converter for XML you can see in this tab. It does not validate against an XSD or DTD, does not talk to a database, and will not merge PDFs. Multi-megabyte documents can still need a local CLI.
- Does the output stay pretty-printed?
- Yes. The default output is indented JSON (two spaces) so you can read nested objects and arrays. Copy or download keeps that formatting. Closing the tab drops the buffer; nothing is uploaded.
- How is this different from XML to CSV?
- XML to CSV flattens repeating sibling rows into a delimited table and rejects non-tabular trees. XML to JSON keeps the document tree as nested objects and arrays, which is a better fit for configs, feeds, and nested payloads. Both run only in this browser tab.
What else can I open?
- JSON to CSVConvert JSON to CSV (and back) entirely in the browser.
- JSON Schema GeneratorGenerate a JSON Schema from a JSON sample in the browser — no upload.
- JSON to ExcelConvert JSON to a real Excel .xlsx file in the browser — nested keys flattened, nothing uploaded.
- CSV to ExcelTurn a CSV or TSV table into a real .xlsx workbook locally in the browser.
- JSON to XMLConvert JSON back to indented XML locally in the browser.
- JWT Token GeneratorCreate and sign a compact HS256 JWT locally in the browser.
These tools run in your browser. Page Utils does not store, upload, or write to localStorage the keys, tokens, or text you paste. Results are a convenience aid, not legal, tax, or security advice.