“We noticed you may be using an ad blocker. SEO Site Checker relies on ads to keep our SEO tools free. Please consider disabling your ad blocker to support us - thank you!”“We noticed you may be using an ad blocker. SEO Site Checker relies on ads to keep our SEO tools free. Please consider disabling your ad blocker to support us - thank you!”
Paste XML, upload a file or load a public URL, then convert it to JSON and view it in a code, tree or form editor. Free, no account needed.
Result
Free XML to JSON Converter: What It Does
Quick answer: This free XML to JSON converter runs in your browser. Paste markup into the box above, upload an .xml file or load a public URL, press Convert to JSON, then copy the result or save it as text. Every value stays a string.
Developers use it to turn an Atom feed, SOAP response or sitemap.xml into a REST API, and analysts who want a tree structure from legacy XML data. One fixed mapping applies: attributes get an underscore, text gets __text and repeated elements become arrays.
How to Convert XML to JSON Online
Add your XML. Paste into Enter or Paste XML, use the upload button for an XML file (the picker shows .xml only, so paste RSS or Atom or rename it), or type an address into Load from URL, which loads after a short pause or when you press Enter.
Press Convert to JSON. A Result card opens.
Review it. Check tree view and code view. Format will pretty print the JSON and Compact strips whitespace. Skip Sort when key order matters.
Copy or save. Copy to Clipboard copies the JSON output. Save as TXT downloads xml-to-json.txt.
Rename the download: the saved file is plain text holding JSON, so change the extension to .json yourself.
XML to JSON Example: Attributes, Text and Repeated Tags
Every output below comes from this page, unedited.
XML feature
JSON result
Note
book with id and lang, title child, price with currency
title "XML Guide", price with _currency "USD" and __text "44.95", _id "bk101", _lang "en"
Attributes land after children
Three book siblings A, B, C
book is an array of A, B, C
Repeated elements
One book sibling A
book is the string "A"
Not an array
x:item with an x:id attribute
item with _x:id "1", __prefix "x", __text "v"
Root gets _xmlns:x
RSS feed with two item elements
item is an array of two objects
rss has _version "2.0"
CDATA holding bold markup
A plain string
Markup kept as text
Empty a and b, c with an attribute
a "", b "", c with _attr "1"
Attributes stay
Number 007
"007"
Stays a string
Loops over book break when one sibling arrives as a string.
How the Converter Maps XML Into JSON
The browser's XML parser rejects anything that is not well formed. Valid documents go to X2JS 1.2.0, which returns one JSON object with nested elements as key value pairs. The output follows RFC 8259.
Every value is a string. The values 44.95, 007, true, 1e400 and 9007199254740993 come out quoted and unchanged.
Order is not kept, and mixed content suffers most. In <p>Hello <b>bold</b> world</p>, b becomes its own key and the two text runs join into one __text string. Siblings a, b, a give a as 1 and 3. A round trip cannot match the original; the XML vs JSON guide explains why.
The underscore prefix and the __text key are fixed. Your browser does the work, so big files slow down faster than they grow: on our test machine, converting and displaying about 1.2 MB took 3 seconds and about 5 MB took 24 seconds. Load from URL stops at 3 MB.
Is Your XML Sent to a Server?
Pasted text and files are parsed on your device by DOMParser; we saw no request to our server during a conversion. Load from URL is the exception: only that address goes to our server, which fetches the public file. For private files, paste instead.
Why You Get an Invalid XML Error
The tool checks for well-formed XML first, per Extensible Markup Language (XML) 1.0, and a parse error shows Invalid XML with line and column. Fixes:
Mismatched tag or unclosed tag: the error often points past the mistake. Close tags in reverse order.
Frequently Asked Questions (FAQs) is a list of common questions and answers provided to quickly address common concerns or inquiries.
How do I convert XML to JSON online?
Paste your XML into Enter or Paste XML, upload an .xml file, or use Load from URL. Press Convert to JSON, then use Copy to Clipboard or Save as TXT. The saved file is .txt, so rename it to .json yourself.
How are XML attributes shown in the JSON?
Each attribute becomes a key with a leading underscore, so id turns into _id. If the element also holds text, that text sits under __text beside the attributes. A price with a currency attribute gives _currency and __text. An item with id 5 and the text x becomes _id 5 and __text x.
Why did a repeated tag turn into an array?
Two or more siblings that share a name become an array, while a single sibling stays a plain value. The converter cannot know your schema, so your code must handle both shapes. Test with one item and with several before trusting a loop.
Are numbers kept as numbers?
No. Every value comes out as a string, so 007, 1.10 and 9007199254740993 survive exactly as written, with nothing rounded. The page has no option for numbers or booleans, so convert types in your own code after you copy the JSON.
Is my XML uploaded to a server?
Pasted and uploaded XML is converted in your browser, and we saw no request to our server during a conversion. Load from URL is different: the address goes to our server, which fetches the public file for you, up to 3 MB.
Can I convert JSON back to XML?
Yes, the JSON to XML converter does the reverse job, but do not expect the original back. Comments, the XML declaration and sibling order are lost, so the result will not match your source. Always keep your source XML file.
We use cookies to personalize content and ads, to provide social media features and to analyze our traffic. You consent to our cookies if you continue to use our website.
Install SEO Site CheckerFree SEO tools - always in your pocket.