XML to JSON
Convert XML into JSON, with attributes kept as @ keys. Nothing is uploaded.
Drop XML files here
Converted on your device. Files are never uploaded.
Up to 20 files at a time.
Plenty of feeds, exports and older APIs still speak XML, while modern code and tools expect JSON. FormatJet parses your XML with fast-xml-parser, turning elements into keys, repeated elements into lists and attributes into keys marked with @. Everything happens in your browser, so the file stays on your device.
About the formats
XMLXML file
XML stores data as nested, named elements with attributes. Feeds, office files, invoices and older web services use it.
JSONJSON file
JSON is the text format web APIs and apps use to exchange data: objects, lists, text, numbers and true or false values, nested as deep as needed.
Converted with Data converters (Papa Parse, yaml, fast-xml-parser), Data converters on Workers.
Questions
What happens to XML attributes?
Each attribute becomes a key starting with @, such as "@id". When an element has attributes and text, its text goes under "#text".
How are repeated elements handled?
Elements that repeat under the same parent, like several <book> elements in a catalogue, become a JSON list.
Are numbers in the XML turned into JSON numbers?
Not by default, because XML stores everything as text. Tick “Store numbers and true/false as values” in Options to turn plain numbers into numbers and true/false into booleans; codes like 02134 stay text.
Is it safe to convert XML from an unknown source?
Entities declared in the document are expanded only within set limits, and nothing the XML points to is fetched from the web.
Is the XML declaration kept?
No. The <?xml …?> declaration and any processing instructions have no place in JSON, so they’re dropped; elements, attributes and text carry over.
XML to JSON with the API
The conversion API opens later this year.
curl https://api.formatjet.com/v1/convert?to=json \
-H "Authorization: Bearer fj_test_…" \
-F file=@input.xml -o output.json