XML to JSON Converter
Convert XML documents to JSON with attribute handling and configurable parsing options
About this tool
This tool converts XML documents into JSON objects using a robust client-side parser. It preserves element nesting, handles attributes (prefixed by default with @_), parses numbers and booleans, and trims whitespace. Use it to bridge XML-based APIs, config files, or legacy data into modern JSON workflows — all processing happens locally in your browser, nothing is uploaded.
Examples & Use Cases
Simple XML to JSON
<!-- XML Input -->
<person>
<name>John Doe</name>
<age>30</age>
<active>true</active>
</person>
// JSON Output
{
"person": {
"name": "John Doe",
"age": 30,
"active": true
}
}A basic XML element with text content is converted to a nested JSON object. Numeric and boolean values are parsed automatically.
XML with Attributes
<!-- XML Input -->
<book id="123" category="fiction">
<title lang="en">The Great Gatsby</title>
<year>1925</year>
</book>
// JSON Output
{
"book": {
"@_id": 123,
"@_category": "fiction",
"title": {
"@_lang": "en",
"#text": "The Great Gatsby"
},
"year": 1925
}
}Attributes are prefixed with @_ by default so they never collide with child element names. Text alongside attributes is nested under #text.
Repeated Elements Become Arrays
<!-- XML Input -->
<library>
<book><title>Book 1</title></book>
<book><title>Book 2</title></book>
</library>
// JSON Output
{
"library": {
"book": [
{ "title": "Book 1" },
{ "title": "Book 2" }
]
}
}Sibling elements with the same tag name are automatically grouped into a JSON array — the natural representation for repeated XML elements.
About this tool
Convert XML to JSON online instantly. Free converter with attribute handling and formatting options — no signup, runs entirely in your browser. XML to JSON Converter runs in the browser on DevTools. There is no signup, and your input stays on this device unless the tool explicitly performs a live network lookup.
What this tool does not do
- XML to JSON Converter is a free in-browser utility, not a hosted API. It does not keep server-side history and is not a substitute for production verification in your own stack.
How do I use this tool?
How do I use XML to JSON Converter?
Open XML to JSON Converter, enter or paste your input, and copy the result. The page works without an account.
Related guides
Related tools
Base64 Toolbox
Professional Base64 workspace for text, files and images with Base64URL, MIME, Data URI, strict validation, image preview and ready-to-use snippets.
C# to VB.NET Converter
Convert a subset of C# — classes, methods, variables, loops — into VB.NET
CSV Data Viewer
Paste CSV and browse rows in a sortable table with delimiter detection
CSV to Chart
Paste or upload CSV data and generate bar, line, pie, or doughnut charts. Export as PNG.
CSV to JSON Converter
Paste CSV data and convert it to pretty-printed JSON instantly — supports custom delimiters, header row toggling, and value trimming.
CSV to Markdown Converter
Convert CSV to a Markdown table and Markdown tables back to CSV