Convert XML into JSON instantly
Paste XML on the left and get JSON on the right — all in your browser

{
"a": {
"_attributes": {
"x": "1.234",
"y": "It's"
}
}
}The XML to JSON converter turns XML markup into a JSON representation you can copy into logs, config files, API payloads, or quick prototypes. Everything runs locally in your browser, so you can safely convert data without sending it to a server.
Quick mental model: XML is a tree. JSON is a tree. The converter maps one tree shape into the other.
Who typically uses this?
Reliability note: This converter uses the same underlying transformation approach as the open-source it-tools implementation.
Related converters you may also want:
If your XML is valid, the JSON output updates automatically. If it's invalid, you'll see a clear error state and the output will stay empty.
Paste your XML
Drop it into the left box. Self-closing tags and attributes are supported.
Check the JSON structure
Attributes typically appear under a dedicated key (for example, _attributes), and text nodes may appear under a text key depending on the XML.
Copy or share
Copy JSON
Use the copy button on the output panel.
Share link
Optionally include your XML in the link.
Interpreting the result (quick sanity checks)
_attributes, that's your XML attributes.Below are two small examples that mirror how the converter represents attributes and how sharing works.
Example 1: attributes on a self-closing tag
Paste this XML:<a x="1.234" y="It's"/>
The converter outputs JSON where attributes are grouped. You don't need to “calculate” anything — just remember attributes are data too.
A quick numeric sanity check
If you plan to share your input via URL, keep it under the built-in limit.
Here is a sample input length (characters) and is the maximum we include in a share link.
Example 2: estimating share-friendly size
If your XML is mostly ASCII, a quick estimate is that one character is roughly one byte. That gives you an intuitive feel for the share limit.
This is a rough estimate, but it's handy when you're copying data from logs.
API migration checks
Background: you receive XML responses but your new service expects JSON.
Input: a sample XML payload. Output: a JSON structure you can map to DTOs.
Tip: once you have JSON, validate/reshape it further with YAML to JSON or your own scripts.
Config conversion
Background: you have XML-based config and want a JSON snapshot for documentation.
Input: an XML config section. Output: JSON you can paste into docs or issues.
Pretty output makes code reviews calmer.
Redacting sensitive fields
Background: XML exports can contain secrets. Convert to JSON, then search-and-replace specific keys.
Input: an XML export. Output: JSON that is easier to scan and sanitize.
Always double-check you didn't share credentials.
Debugging and logging
Background: your logs store JSON more cleanly than XML.
Input: a failing XML sample. Output: JSON you can paste into tickets.
Next step: if your JSON needs to become YAML for config files, use JSON to YAML converter.
You have XML snippets in docs
Convert them to JSON examples for easier copy/paste in code.
You need JSON for quick tooling
Many CLIs and APIs accept JSON natively.
You want a safer review format
JSON is often easier to diff and review than raw XML.
You need to paste into a bug report
JSON tends to be more compact and familiar to reviewers.
You want to share a reproducible sample
Use the Share dialog to generate a link, optionally including input.
When it may not fit
If your XML uses complex mixed content, mapping can be surprising.
When it might not be ideal
Keep the XML minimal when debugging
Start with the smallest XML that reproduces your issue. Once the JSON shape makes sense, add fields back.
Avoid accidental leaks
Normalize after converting
If you need the output in another format, convert the JSON further:
Conceptually, the converter parses XML into an internal object tree, then serializes that tree as JSON. The formatting uses a fixed indentation for readability.
High-level transformation
Here is the parsed tree and is the formatted JSON string (pretty-printed with spaces).
Variables
Why attributes look different
XML distinguishes between attributes and nested elements, while JSON does not. Converters typically preserve that distinction using a dedicated key (like _attributes) so that you don't lose information.
Arrays vs objects
XML doesn't have a built-in array type. Repeated sibling tags (like multiple <item>) are often treated as arrays in JSON. If your downstream code expects arrays, confirm the shape using a small sample first.
_attributes key?Because JSON doesn't have a native concept of XML attributes. Grouping attributes under a dedicated key keeps the conversion lossless.
Not necessarily. Some XML structures represent lists using wrappers or explicit item tags. If you need a specific array shape, you may need an extra normalization step after conversion.
No. Conversion happens locally in your browser.
Pretty output is easier to read and debug. This tool formats JSON with spaces so it's clean to copy.
The input panel will show an error state and the output will remain empty until the XML becomes valid.
Converting XML to JSON is not always one-to-one. Mixed content, namespaces, and custom conventions can produce surprising shapes. Always validate the result against your downstream requirements.
Not professional advice
This tool is a convenience converter. For critical systems, implement a dedicated schema-driven mapper and add tests.
Parse and decode your JSON Web Token (JWT) and display its content. All computation runs locally in your browser.
Transform text into the NATO phonetic alphabet for oral transmission. Convert letters A–Z into Alpha/Bravo/Charlie… and copy instantly.
Convert text to ASCII (8-bit) binary and convert ASCII binary back to text. Clean input automatically and copy results instantly.
Convert text to Unicode decimal HTML entities (e.g., A) and convert them back to text. Runs locally in your browser with one-click copy.
Escape and unescape HTML entities for <, >, &, ", and ’. Runs locally in your browser with instant copy.
Edit rich text in a simple WYSIWYG editor and copy Prettier-formatted HTML instantly. Runs locally in your browser.