XML to JSON Converter
Convert XML to JSON in your browser. Attributes preserved with @_ prefix, repeated elements become arrays. Validates with line numbers. Free.
About this tool
Parse XML (API responses, RSS feeds, sitemaps, SOAP envelopes) into workable JSON. Attributes are preserved with an @_ prefix, and repeated sibling elements are collected into arrays.
Invalid XML is rejected with the exact line and column of the problem, which makes this a fast way to find the unclosed tag in a large document.
Common uses
- Turn a legacy XML API response into JSON your frontend can consume.
- Inspect RSS/Atom feeds or sitemap.xml files as structured data.
- Extract values from SOAP responses without writing an XML parser.
Automate via API
The same conversion is available as a REST endpoint for scripts, pipelines, and backends:
curl -X POST https://payloadly.com/api/v1/tools/xml-to-json \ -H "Content-Type: text/plain" \ -H "X-Api-Key: YOUR_API_KEY" \ --data-binary @input.xml
Worked examples
Real payloads from tools people use daily, with the exact output this converter produces. Every example runs in your browser, so you can load one and adapt it to your own data.
Convert an RSS feed to JSON
RSS items are repeated <item> elements, so they parse into a clean JSON array you can map over in a script.
<rss version="2.0">
<channel>
<title>Example Blog</title>
<link>https://example.com</link>
<item>
<title>First post</title>
<link>https://example.com/first</link>
<pubDate>Mon, 01 Jun 2026 09:00:00 GMT</pubDate>
</item>
<item>
<title>Second post</title>
<link>https://example.com/second</link>
<pubDate>Tue, 02 Jun 2026 09:00:00 GMT</pubDate>
</item>
</channel>
</rss>{
"rss": {
"channel": {
"title": "Example Blog",
"link": "https://example.com",
"item": [
{
"title": "First post",
"link": "https://example.com/first",
"pubDate": "Mon, 01 Jun 2026 09:00:00 GMT"
},
{
"title": "Second post",
"link": "https://example.com/second",
"pubDate": "Tue, 02 Jun 2026 09:00:00 GMT"
}
]
},
"@_version": "2.0"
}
}Convert a sitemap.xml to JSON
Each <url> becomes an object, so you can programmatically audit locs and lastmod dates from a sitemap.
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2026-06-01</lastmod>
<priority>1.0</priority>
</url>
<url>
<loc>https://example.com/pricing</loc>
<lastmod>2026-05-20</lastmod>
</url>
</urlset>{
"urlset": {
"url": [
{
"loc": "https://example.com/",
"lastmod": "2026-06-01",
"priority": 1
},
{
"loc": "https://example.com/pricing",
"lastmod": "2026-05-20"
}
],
"@_xmlns": "http://www.sitemaps.org/schemas/sitemap/0.9"
}
}Convert a SOAP response to JSON
Namespaced elements keep their prefix as the key, so you can reach into a SOAP envelope without an XML library.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<GetPriceResponse>
<Price>34.50</Price>
<Currency>USD</Currency>
</GetPriceResponse>
</soap:Body>
</soap:Envelope>{
"soap:Envelope": {
"soap:Body": {
"GetPriceResponse": {
"Price": 34.5,
"Currency": "USD"
}
},
"@_xmlns:soap": "http://www.w3.org/2003/05/soap-envelope"
}
}XML notes
XML remains entrenched in enterprise integrations, SOAP services, RSS/Atom feeds, and sitemaps. Unlike JSON, it distinguishes attributes from child elements and supports namespaces.
- XML attributes are represented with an `@_` prefix when converted to JSON.
- Repeated sibling elements become arrays; single elements become objects.
- XML documents need exactly one root element.
JSON notes
JSON (JavaScript Object Notation) is the standard interchange format for web APIs, config files, and log pipelines. It is strict: keys must be double-quoted, trailing commas are invalid, and comments are not allowed.
- JSON does not support comments; they are stripped or rejected by parsers.
- Trailing commas after the last element are invalid JSON.
- Integers beyond 2^53 lose precision in JavaScript-based parsers.
Frequently asked questions
Is my data uploaded to a server?
No. This tool runs entirely in your browser using JavaScript, and there are no ads on the page. Nothing you paste or drop here is uploaded, logged, or stored, and you can verify that yourself: open your browser's developer tools and watch the Network tab while you convert (no requests leave the page), or disconnect from the internet after the page loads and keep working.
What should I watch out for when converting XML to JSON?
XML attributes are represented with an `@_` prefix when converted to JSON. Repeated sibling elements become arrays; single elements become objects. JSON does not support comments; they are stripped or rejected by parsers. Trailing commas after the last element are invalid JSON.
Why do some elements become arrays and others objects?
XML cannot distinguish 'a list with one item' from 'a single element', so single occurrences parse as objects and repeated siblings parse as arrays. If your code needs a guaranteed array, normalize after conversion.
Is there a size limit or a fee?
The browser tool is free with no signup and comfortably handles files up to tens of megabytes (limited by your device's memory). For automated or bulk processing inside your own scripts and pipelines, use the paid REST API.
Related tools
Convert JSON to formatted XML in your browser. Keys become elements, @_ prefixed keys become attributes. Free, private, no upload.
Format and indent XML in your browser. Validates first and reports the exact line of any error. Free, private, nothing uploaded.
Flatten nested JSON to single-level dot-notation keys in your browser. Ideal for CSV prep, diffing, and key inventories. Free, no upload.
Format and beautify JSON in your browser with 2-space, 4-space, or tab indentation. Errors reported with line and column. Free, no upload.