# XML to JSON Converter

Convert XML data to JSON format with customizable parsing options

> Canonical page: https://elysiatools.com/en/tools/xml-to-json

- **Category:** Format Conversion

- **Keywords:** xml, json, converter, transform, parse, xml to json, xml converter

## Overview

The XML to JSON Converter is a streamlined utility designed to transform complex XML structures into clean, readable JSON format. It offers granular control over parsing, allowing you to manage attributes, namespaces, and array simplification to ensure your output perfectly matches your application's requirements.

## Inputs

- **XML Input** (textarea): Enter XML data...
- **Pretty Print Output** (checkbox)
- **Include XML Attributes** (checkbox)
- **Keep XML Namespaces** (checkbox)
- **Simplify Single Element Arrays** (checkbox)

## When to use

- When migrating data from legacy XML-based systems to modern web applications that require JSON.
- When you need to clean up verbose XML structures by simplifying single-element arrays.
- When preparing API payloads that require specific handling of XML attributes or namespaces.

## How it works

- Paste your raw XML data into the input field.
- Adjust the configuration checkboxes to include or exclude attributes, namespaces, and array simplification.
- Click the convert button to generate the formatted JSON output instantly.
- Copy or download the resulting JSON for use in your development projects.

## Use cases

- Standardizing configuration files for web services that prefer JSON over XML.
- Transforming SOAP API responses into JSON for easier integration with frontend frameworks.
- Cleaning up exported database records for use in NoSQL document stores like MongoDB.

## Frequently asked questions

### Can I keep XML attributes in the JSON output?

Yes, enable the 'Include XML Attributes' option to preserve attribute data within your JSON objects.

### What does 'Simplify Single Element Arrays' do?

When enabled, it converts arrays containing only one item into a single object, making the JSON structure cleaner and easier to access.

### Does this tool support XML namespaces?

Yes, you can toggle the 'Keep XML Namespaces' option to retain or strip namespace prefixes during conversion.

### Is the output JSON formatted for readability?

Yes, the 'Pretty Print Output' option is enabled by default to ensure the generated JSON is indented and easy to read.

### Is there a limit to the size of the XML I can convert?

The tool is designed for standard XML data sets; for extremely large files, ensure your browser has sufficient memory to process the transformation.

## Related tools

- [Excel to JSON Converter](https://elysiatools.com/en/tools/excel-to-json): Convert Excel file to JSON format, extracting data from the first worksheet
- [GeoJSON to OSM Converter](https://elysiatools.com/en/tools/geojson-to-osm): Convert GeoJSON format to OpenStreetMap (OSM) XML format
- [JSON to XML Converter](https://elysiatools.com/en/tools/json-to-xml): Convert JSON data to XML format with customizable formatting options
- [OSM to GeoJSON Converter](https://elysiatools.com/en/tools/osm-to-geojson): Convert OpenStreetMap (OSM) XML data to GeoJSON format
- [BOM Character Remover](https://elysiatools.com/en/tools/data-bom-remover): Remove BOM (Byte Order Mark) characters from text and file content. Perfect for cleaning up text files that have encoding issues, fixing CSV imports, and preparing data for processing. Features: - Detect and remove UTF-8 BOM (EF BB BF) - Detect and remove UTF-16 BOM (FE FF or FF FE) - Detect and remove UTF-32 BOM (00 00 FE FF or FF FE 00 00) - Support multiple input formats - Visual BOM character display - Detailed detection report - Support for batch text processing Common Use Cases: - Fix CSV file import errors - Clean up text file encoding issues - Prepare data for JSON parsing - Fix XML parsing problems - Resolve API data encoding conflicts - Standardize text data format
- [Text to JSON Converter](https://elysiatools.com/en/tools/text-to-json): Convert various text formats to JSON with customizable parsing options
- [BSON Converter](https://elysiatools.com/en/tools/bson-converter): Encode and decode data to/from BSON (Binary JSON) format
- [Netrc Parser](https://elysiatools.com/en/tools/netrc-parser): Parse and convert Netrc file format to JSON

## Samples

- [Android Serialization Java Samples](https://elysiatools.com/en/samples/android-serialization-java): Android Java serialization examples including JSON serialization, deserialization, and XML parsing
- [Android Serialization Kotlin Samples](https://elysiatools.com/en/samples/android-serialization-kotlin): Android Kotlin serialization examples including JSON serialization, deserialization, and XML parsing
- [macOS Serialization Objective-C Samples](https://elysiatools.com/en/samples/macos-serialization-objectivec): macOS Objective-C serialization examples including JSON serialization, JSON deserialization, and XML parsing
- [macOS Data Serialization Swift Samples](https://elysiatools.com/en/samples/macos-serialization-swift): macOS Swift data serialization examples including JSON serialization, deserialization, and XML parsing

## Related content

- [XML Conversion, Mapping, and XPath Tools](https://elysiatools.com/en/hubs/xml-convert): Curated tools for XML conversion, mapping, merging, and XPath extraction in one hub.
- [JSON Interchange and Format Translation Tools](https://elysiatools.com/en/hubs/json-convert): Compare JSON conversion tools for CSV, YAML, TOML, GraphQL, XML, Markdown, Excel, BSON, EDN, and related structured formats in one hub.
- [JSON Inspection, Diff, and Transformation Tools](https://elysiatools.com/en/hubs/json-utility): Compare JSON formatting, diffing, path inspection, schema validation, merging, transformation, and export tools in one hub for API and data workflows.
- [JSON Schema, Mock Data, and API Fixture Generators](https://elysiatools.com/en/hubs/json-generate): Curated tools for JSON schema generation, mock payload building, and API fixture preparation in one hub.
