Convert between XML and JSON formats. Auto-detects input format.
Paste XML or JSON into the input area. The format is automatically detected.
Click the "Convert to JSON" or "Convert to XML" button.
Copy the conversion result to the clipboard using the copy button.
XML-JSON Converter is an online tool that converts between XML and JSON formats. Convert legacy XML data to JSON for modern APIs, or transform JSON responses into XML for systems that require it. The format is auto-detected, so you can simply paste your data and convert instantly.
XML is a markup language using tags and attributes to represent data, supporting comments, namespaces, and schema validation. JSON is a lightweight data format based on JavaScript object notation, using key-value pairs. JSON is widely used for API data exchange due to its simplicity and smaller size.
XML attributes are converted to special JSON keys (prefixed with @). For example, <item id="1"> becomes {"@id": "1"}. Text content is represented as {"#text": "value"}. This preserves all information from the XML structure.
XML comments (<!-- -->) and processing instructions (<?...?>) may be removed during conversion. XML namespaces are represented differently in JSON. CDATA sections are expanded as plain text.
If the first non-whitespace character is "<", the input is detected as XML. If it starts with "{" or "[", it is detected as JSON. The detection result is shown above the input area.
No, all processing happens entirely in your browser. Your input data is never sent to any server. You can safely use this tool with confidential data.