XML to JSON Converter
Parse XML back into JSON with configurable attribute prefixes, text node handling, and array coercion. Great for legacy API migration.
Output will appear here…Convert XML back into JSON
XML and JSON represent data very differently. XML has attributes, text content, mixed content, namespaces, and processing instructions — none of which have a direct equivalent in JSON. Converting XML to JSON is therefore lossy: you have to make decisions about how to represent each XML feature in JSON. Lintify uses sensible defaults that work for most modern XML, but understanding those decisions helps you interpret the output correctly.
The converter uses fast-xml-parser, a popular JavaScript XML library. Attributes are turned into JSON keys with a configurable prefix (default@), so an attribute id="42"becomes {"@id": "42"}. The prefix is necessary so that attributes and child elements with the same name do not collide in the resulting object.
How text content is handled
XML elements can have both text content and child elements — JSON has no equivalent of this "mixed content". Lintify uses a configurable key (default#text) for the text content of an element. If an element has only text and no children, you can configure the converter to collapse the element to a plain string value, which produces cleaner JSON when you do not need to preserve the attribute-or-text distinction.
How arrays are represented
XML does not distinguish between a single child element and a list of one element. <user>Ada</user>could be a single user or a list with one user. Lintify treats repeated tag names as arrays — if the same tag appears multiple times as a child of the same parent, the values are collected into a JSON array. If a tag appears only once, it is a single object. This matches what most consumers expect.
Namespaces and CDATA
Lintify preserves namespace prefixes as part of the element name — soap:Envelope stays as the keysoap:Envelope. It does not resolve namespace URIs to fully-qualified names because that requires an external schema and is rarely what you want when converting XML to JSON. CDATA sections are treated as text content of the parent element and merged with any surrounding text. The CDATA wrapper itself is not preserved because JSON has no equivalent concept.
Frequently asked questions
Common questions about the XML → JSON tool.