Convert XML to JSON

Convert XML to JSON free in your browser. No upload, no signup, no watermark. Files stay on your device.

privatepowered by fast-xml-parser
xmljson

drop a .xml file

or click to browse

related

more xml & json

see all data & code converters →

guide

how to convert xml to json

  1. Drop your XML file

    Drag your XML file into the drop zone above, or click the box to pick a file from your computer or phone. The browser reads the file directly — nothing uploads.

  2. Click Convert

    The page runs fast-xml-parser on your device to decode the Extensible Markup Language and encode it as JavaScript Object Notation. Most conversions finish in a few seconds; large or codec-heavy files (RAW, video) can take longer.

  3. Download the JSON file

    When the conversion finishes, the JSON file is ready to download. Save it anywhere on your device.

FAQ

common questions

Why convert XML to JSON?

Two main reasons: (a) integrating XML-emitting legacy systems with modern JavaScript / Node.js / React codebases that prefer JSON natively; (b) feeding XML data into NoSQL document stores that expect JSON. JSON is easier to work with in modern stacks; XML remains the format many enterprise systems emit.

How does XML structure map to JSON?

Elements become object keys; element content becomes string values; nested elements become nested objects. So `<user><name>Alice</name></user>` becomes `{user: {name: 'Alice'}}`. Multiple sibling elements with the same name typically become arrays. XML attributes get folded in as object keys, sometimes prefixed (`@id`) to distinguish from element children.

What about XML attributes?

Folded into the object. Different converters use different conventions: some prefix attributes with `@` or `_` to distinguish from child elements, some put them in a sub-object. So `<book id='42'>Title</book>` might become `{book: {@id: '42', #text: 'Title'}}` or similar. Check the output structure if you're consuming it programmatically.

Will the JSON preserve types?

Not automatically. XML text content is always strings — `<age>30</age>` becomes `{age: '30'}` (string, not number). For typed output, post-process the JSON to convert known numeric / boolean fields. JSON schema validation tools can do this systematically if you have a schema.

What if my XML has namespaces?

Most converters either ignore namespaces (just use element local names) or include them as prefixes in the JSON keys (`{ns:user: {...}}`). Namespace handling is the messiest part of XML-to-JSON conversion; the right behaviour depends on what your downstream code expects.