Skip to tools
JSON Toolbox- Free online JSON tools

XML to JSON

Convert XML to a JSON structure online. Elements, attributes, and text are preserved in a predictable shape.

  • 100% client-side, nothing uploaded
  • Instant results
  • Works offline once loaded
Input XML

Empty

JSON output

Empty

How it works

About this tool

This XML to JSON converter parses XML and produces a JSON object that mirrors its structure. Child elements become nested objects, repeated elements become arrays, and attributes are preserved with an @ prefix.

Text content is type-inferred where it is unambiguous, so numeric and boolean values become real JSON types. Elements that have both text and attributes keep their text under a #text key so nothing is lost.

Use it to inspect XML feeds, migrate legacy XML configs toward JSON APIs, or preview how an XML document would look as objects and arrays.

Parsing uses your browser’s built-in XML engine and runs entirely on your device, keeping your data private.

JSON Toolbox processes all data locally in the browser. Nothing is uploaded to a server.

Common questions

Frequently asked questions

How do I convert XML to JSON?
Paste your XML document (or load a file). Valid XML is converted to structured JSON immediately, ready to copy or download.
How are attributes represented?
Attributes are added to the element’s object with an @ prefix, for example @id, so they never collide with child element names.
What about repeated elements?
When an element appears more than once inside the same parent, those occurrences are collected into a JSON array automatically.
What if the XML is malformed?
The converter detects XML parse errors and reports them, so you can correct the document before converting. Nothing is uploaded while you iterate.

Keep exploring

Browse all