XML to JSON Converter
Convert XML to JSON online. Attributes are kept with an @_ prefix, repeated elements become arrays, and invalid XML is reported with a line number. Everything runs locally in your browser; nothing is uploaded.
Paste XML. Elements become keys, attributes appear with an @_ prefix, and repeated sibling elements become arrays. Invalid XML shows an error with the line number.
XML
JSON
Output appears here.Learn more
A lossy conversion
XML has attributes, mixed text and ordering that JSON does not. The converter keeps attributes and text, but the order of different element names is not guaranteed.
Single versus repeated elements
One child becomes an object, two or more become an array. Code that reads the result should handle both shapes.
Frequently asked questions
Why are numbers strings?
XML has no types, so values are kept as text to avoid changing data such as leading zeros.
How are attributes shown?
With an @_ prefix, for example @_id.
What if my XML is invalid?
The tool reports the problem and its line number instead of guessing.