TheDevTab
Tools

Search tools and guides

Ctrl K

Keyboard shortcuts

Ctrl K
Search tools and guides
?
Show keyboard shortcuts
Escape
Close menus and dialogs

XML to JSON

Map XML roots, repeated elements, and scalar types to JSON.

Runs in your browser. Nothing is uploaded.

Parse XML into readable JSON

XML to JSON reads a well-formed XML document and formats the parsed result as JSON with two-space indentation. Paste an XML document, use the sample, or drop a .xml file into the input area. The tool uses an XML parser rather than searching for angle brackets, so nested elements, quoted attributes, and escaped text are handled as structured input.

The output is useful for inspecting a feed, checking a payload, or moving data into a JSON-based workflow. It is still a mapping, not a universal XML-to-JSON standard. For the reverse direction, use JSON to XML.

Elements, attributes, and repeated values

XML can represent information with element names, attributes, namespaces, text nodes, and repeated children. JSON has objects and arrays instead, so the converter must represent those XML concepts using this converter's rules. Repeated elements may become an array, while a single element may remain a scalar or object depending on its content.

Review attributes and namespaces carefully when the document is part of a strict contract. Mixed content, comments, processing instructions, and schema annotations may not have a direct JSON equivalent. Keep the original XML beside the converted file when you need a traceable record of the source.

Text values and types

XML primarily stores text. A value that looks like a number, boolean, or date may be represented according to the converter's scalar rules, but the XML schema remains the authority for its meaning. Check leading zeros, whitespace, empty elements, and date formats before using the generated JSON in an application.

Invalid XML is not partially displayed as a successful result. An unclosed tag, malformed entity, or broken root structure produces an error and clears the previous output. Once the result is valid, JSON Formatter can help inspect or minify it.

Keep the conversion local

XML parsing, JSON formatting, file reading, copying, and downloading happen in your browser. Nothing is uploaded. Review the generated keys and arrays before downloading converted.json, especially when the source contains credentials or personal data. If the receiving system expects YAML, compare the result with JSON to YAML, or start from YAML to JSON when the source file is already YAML.

FAQ

Does XML to JSON upload a dropped file?

A dropped file is read as text and converted to JSON in your browser. The XML is never uploaded, and TheDevTab never receives it.

What XML can be converted?

Well-formed XML with a document root can be converted, while parser errors are reported instead of returning partial JSON. Child elements, attributes, and direct text are traversed, but comments and processing instructions are not represented in the value.

What happens to XML attributes?

Each attribute becomes an object property whose name starts with @, such as @id. Direct text alongside child elements becomes a #text property, so review mixed-content output against the schema expected by your application.

How are repeated elements represented?

The first child with a name becomes a scalar or object property, and later children with that name turn the property into an array. Force arrays wraps even a single child value in an array.

Are XML values returned as strings?

Yes by default. Coerce types converts the exact text true, false, and matching finite numbers, while values such as 007 remain strings because they do not match the numeric rule.

What does Include root element change?

With Include root element enabled, the result is wrapped under the original root tag name. With it disabled, the root's attributes, text, and child elements are returned directly.

How is the JSON output formatted?

The result is serialized as JSON with two-space indentation. Use JSON Formatter if you need to inspect, sort, minify, or validate the converted document further.