These cookies do not access your files. Your choice does not change which tools you can use, and you can update it anytime under Cookie choices.

Cookie details

Analytics: Google Analytics and Umami count visits and tool use. We save tool search text and may record a sample of browsing sessions with private areas masked.

Ads: Google AdSense displays a footer ad. Google Ads and Reddit measure which ads bring people here.

XML to JSON

Pick file or take photo

More tools

How to check an XML record in JSON

Use a small sample when an XML feed will become input to a JavaScript app. Pick a record that has an attribute, a repeated element, and a value your app will look up.

After conversion, inspect those fields before wiring the result into code. A field that appears once and a field that repeats may have different shapes in JSON, so test both examples.

FAQ

Which records are useful test cases when a parser expects a list?

Test one record with a single occurrence and another with repeats of the same XML element. Handle the resulting shapes your consumer actually receives.

How do I convert XML to JSON?

Choose the XML file and press Convert to JSON. You get a JSON file with the same structure.

How are attributes shown?

Each attribute becomes a key that starts with @, such as @id.

What happens when an element repeats?

The repeats become a JSON list under one key.

Where does an element's text go when it also has attributes?

Under a key named #text, beside the @ keys.

It says the XML could not be read. Why?

A tag is closed out of order or left open. Fix the file so every opening tag has a matching closing tag.

Is my file uploaded?

No. The file is converted inside your browser and never sent to a server. It is free.

Sign in

Use Google, Apple, or email. No account is needed to download. Sign in for the larger phone limit and saved favorite tools.