Skip to main content

XML to JSON Converter

Paste XML and get clean JSON output instantly. Attributes become @key fields, repeated elements become arrays, and true/false/numbers are auto-cast. Useful for REST API migration, config parsing, and SOAP response handling.

✓ 60K+ developers trust DevPlaybook ✓ Runs 100% in your browser ✓ Type-aware conversion

Frequently Asked Questions

How are XML attributes converted to JSON?▼

XML attributes are prefixed with @ in the JSON output. For example, <book category="fiction"> becomes { "@category": "fiction" }. This convention is used by many XML-to-JSON libraries including xml2js and fast-xml-parser.

What happens to XML text nodes?▼

If an element has only text content and no attributes, its value is the JSON value directly (e.g. <title>Clean Code</title> becomes "title": "Clean Code"). If the element also has attributes, the text goes into a special #text key alongside the attributes.

How are repeated XML elements handled?▼

When multiple sibling elements share the same tag name, they are combined into a JSON array. For example, two <book> elements become "book": [{...}, {...}]. A single element remains a plain object, not a one-element array.

Are booleans and numbers preserved?▼

Yes. Text values that look like true, false, or numbers are automatically cast to their native JSON types. So <inStock>true</inStock> becomes "inStock": true and <price>12.99</price> becomes "price": 12.99. This matches common XML parsing behavior.

Does it support XML namespaces?▼

Namespace prefixes are preserved as-is in the key names (e.g. <soap:Body> becomes "soap:Body"). Namespace declarations (xmlns:*) appear as @xmlns attributes. Full namespace URI resolution is not performed.

Is my XML data sent to any server?▼

No. All conversion uses the browser's built-in DOMParser API. Your XML data never leaves your machine — safe for sensitive data, internal API responses, and enterprise XML documents.

Looking for more free developer tools?

Browse All Free Tools →
Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

JSON Diff Viewer JSON Diff YAML to JSON Converter JSON Formatter Pro XML Formatter & Validator JSON Path Finder OpenAPI Validator CSV to JSON Converter JSON ↔ YAML Converter TOML to JSON Converter Timestamp Converter JSON Schema Form Builder TOML to JSON Converter Protobuf to JSON Converter CSV JSON Transformer XML Prettifier JSON Schema to Zod Converter API Response Mock Generator API Response Time Tester JSON Formatter & Validator JSON Schema Generator JSON to CSV Converter Unix Timestamp Converter OpenAPI Schema Validator API Mock Server Config Generator YAML to TOML Converter OpenAPI Mock Generator API Test Case Generator API Rate Limit Calculator API Request Builder API Response Formatter & Analyzer Color Format Converter .env File Parser & Validator JSON to TypeScript Interface package.json Validator & Audit Timezone Converter package.json Generator YAML to TOML Converter Color Format Converter — HEX, RGB, HSL, HSV OpenAI Function Calling Generator HTTP API Tester JWT Decoder String Case Converter Text ↔ Binary ↔ Hex Converter TOML Validator URL Parser & Builder WebP Converter LLM Cost Calculator Grafana Dashboard JSON Validator JWT Debugger Pro AI Prompt Cost Calculator REST API Request Builder LLM Prompt Cost Calculator Mock Data Generator API Response Mocker LLM JSON Schema Builder IPFS CID Version Converter Number System Converter — Binary Octal Decimal Hex AI Rate Limit Calculator WebAssembly Binary Inspector Grafana Dashboard JSON Builder HTTP Headers Analyzer API Key Generator AI Doc Generator — Pro Tool AI Regex Explainer — Pro Tool Aspect Ratio Calculator Base64 Encoder & Decoder Base64 Encode / Decode Code Tools Color Picker & Code Converter CSS Unit Converter CSV Viewer HTML to Markdown Converter HTTP Methods Reference HTTP Code Snippet Generator HTTP Status Code Reference HTTP Status Code Reference Image to Base64 Converter JWT Builder Number Base Converter URL Slug Generator Text Tools TypeScript Playground TypeScript to JavaScript Converter Developer Utilities YAML Validator & Formatter Rate Limiter Tester API Changelog Generator PWA Manifest Generator HTTP Mock Response Builder Fake Data Generator Rate Limit Calculator Biome Config Generator Package Lock Analyzer Feature Flag Config Generator CORS Policy Builder GCP Service Account Key Checker Azure ARM Template Validator HTTP Cookie Parser Zod Schema Generator SBOM Generator HTTP Status Code Lookup Markdown to HTML Converter HTTP Status Code Lookup Vue Component Generator WASM Module Explorer GraphQL Fragment Generator HTTP Status Code Reference TypeScript tsconfig.json Generator LLM Context Window Calculator LLM Token Counter Chrome Extension Manifest Generator SAML Request Decoder Prompt Token Estimator YAML Validator Pro Mock Service Worker (MSW) API Mocking Guide Pulumi Modern IaC Guide Certificate Decoder Sitemap.xml Validator SSL Certificate Decoder SQL to TypeScript Types Jest to Vitest Migrator MCP Endpoint Tester Solana Program ID Generator EVM Calldata Decoder Morse Code Converter Roman Numeral Converter MCP Server Config Builder HTML5 Canvas API Playground Token Context Calculator LangGraph Workflow Visualizer AWS IAM Policy Generator TLS Certificate Decoder GCP Service Account Key Auditor Expo App Config Generator React Native StyleSheet Generator Token Counter & Cost Estimator AI API Rate Limit Calculator LLM Prompt Template Builder NFT Metadata Generator

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →