XML to JSON Converter
Convert between XML and JSON formats instantly. Configurable attribute handling, array detection, pretty printing, and more. Everything runs in your browser — your data stays private.
About XML & JSON Conversion
XML (eXtensible Markup Language) and JSON (JavaScript Object Notation) are two of the most widely used data interchange formats. XML has been the standard for enterprise systems, SOAP APIs, configuration files, and document formats like SVG and RSS. JSON has become the dominant format for REST APIs, web applications, and modern configuration files due to its simplicity and native JavaScript support.
Converting between these formats is a common task when integrating legacy systems with modern APIs, migrating data, or working with tools that expect a specific format. This converter handles the full range of XML features including attributes, namespaces, CDATA sections, mixed content, and deeply nested structures.
Key Features
- Bi-directional conversion: XML to JSON and JSON to XML
- Configurable XML attribute handling (grouped, prefixed, or merged)
- Automatic array detection for repeated sibling elements
- Force arrays mode for consistent data structure
- Compact mode to strip empty values and whitespace-only text
- Custom root element name for JSON to XML conversion
- Optional XML declaration and pretty printing
- Syntax highlighting in the output panel
- File upload via drag and drop
- 100% client-side — your data never leaves your browser
How Attributes Are Handled
XML attributes have no direct equivalent in JSON, so the converter offers three strategies. The @attributes object approach groups all attributes under a dedicated key, keeping them separate from child elements. The prefix with @ option places each attribute alongside child elements with an @ prefix. The merge option combines attributes directly with element content, which produces the most compact output but may cause key collisions.