Skip to main content
XML → JSON
XML → JSONReady
Indent
XML Input
0 lines · 0 B
Raw input remains untouched until you click Format
JSON OutputEditable
0 lines · 0 B
Ready to copy (⌘⇧C) or download (⌘S)

XML to JSON Converter

Convert XML documents and RSS/Atom feeds to structured JSON objects online with attribute preservation and clean hierarchy parsing in your browser.

Attribute preservation
Array grouping
Type inference
Download .json
Step-by-Step Guide

How to Use XML → JSON Online

Follow these quick steps to process your data online directly in your browser with zero latency and 100% privacy.

1
Step 1Uses fast-xml-parser to construct JavaScript objects from XML.
2
Step 2Converts XML attributes into @_ prefixed properties.
3
Step 3Transforms repeating XML tags into JSON arrays.
Demonstration

Example Input & Output

Parses XML elements and attributes into a structured JSON hierarchy, converting numeric and boolean strings into native JSON types.

XML Input
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
  <book category="fiction">
    <title>The Great Gatsby</title>
    <author>F. Scott Fitzgerald</author>
    <year>1925</year>
    <price>10.99</price>
  </book>
</bookstore>
JSON Output
{
  "bookstore": {
    "book": {
      "@_category": "fiction",
      "title": "The Great Gatsby",
      "author": "F. Scott Fitzgerald",
      "year": 1925,
      "price": 10.99
    }
  }
}
Applications

Common Use Cases

Modernizing Legacy APIs

Convert legacy XML SOAP service responses into JSON for frontend consumption.

Data Migration

Ingest XML exports into MongoDB or PostgreSQL JSONB databases.

Guidelines

Specifications & Gotchas

Single Item Arrays

A single XML element with repeating sibling potential may parse as an object rather than an array unless configured.

Knowledge

Frequently Asked Questions

How are XML attributes converted to JSON?

Attributes are mapped to prefixed properties (e.g. @_category) within the corresponding object.

How are repeating XML elements handled?

Repeating tags with identical names are grouped into JSON arrays.

Workflow

Related Tools

All Tools →