XML-JSON Converter

Convert between XML and JSON formats instantly. Free bidirectional converter supporting custom formatting, attributes, and nested structures.

Upload
Drag & drop file here
or click to browse

About XML-JSON Converter

XML-JSON Converter is a free online tool that converts between XML (eXtensible Markup Language) and JSON (JavaScript Object Notation) formats. Convert XML to JSON or JSON to XML with support for attributes, nested structures, and custom formatting—all processed locally in your browser for complete privacy.

Why convert between XML and JSON?

XML and JSON are both popular data interchange formats, but they're used in different contexts:

- XML: Common in legacy systems, SOAP APIs, configuration files, and enterprise applications
- JSON: Standard for modern REST APIs, web applications, and NoSQL databases

Converting between formats allows you to:
- Integrate legacy XML systems with modern JSON APIs
- Process XML data in JavaScript applications
- Transform JSON data for XML-based systems
- Migrate data between different platforms

How are XML attributes handled?

XML attributes are converted to JSON properties with a special prefix:

- Enabled (default): Attributes become properties with '@_' prefix
Example: <book id="1"> becomes {"@_id": "1"}

- Disabled: Attributes are ignored during conversion

When converting JSON to XML, properties with '@_' prefix are automatically converted back to XML attributes, preserving the original structure.

Does my data leave my device?

No. All XML-JSON conversion happens entirely in your browser using JavaScript. Your data never leaves your machine, ensuring complete privacy for sensitive information like configuration files, API responses, or confidential data structures.

What is 'Parse Tag Values'?

This option automatically converts XML text content to appropriate data types in JSON:

- Enabled (default): Converts numbers, booleans, and null values
Example: <age>30</age> becomes {"age": 30} (number, not string)

- Disabled: All values remain as strings
Example: <age>30</age> becomes {"age": "30"} (string)

This is useful when you want to preserve exact data types for use in programming.

Can I customize the XML output formatting?

Yes. When converting JSON to XML, you can:

1. Set a custom root element name (default: 'root')
2. Enable/disable XML formatting (pretty-print)
3. Choose indent size (2 or 4 spaces)

The converter automatically adds the XML declaration (<?xml version="1.0"?>) and properly formats nested structures for readability.

How are JSON arrays handled in XML?

JSON arrays are converted to repeated XML elements with the same tag name:

JSON: {"books": [{"title": "Book 1"}, {"title": "Book 2"}]}
XML:
<books>
<title>Book 1</title>
<title>Book 2</title>
</books>

This is the standard XML representation of lists, commonly used in RSS feeds, SOAP responses, and configuration files.