Converter

XML to JSON

Paste XML or JSON, choose how the shape should map, and convert with one click. The parser keeps comments, CDATA and mixed content, points at the exact line of every problem, and measures what the conversion costs you.

Errors with line and columnRound-trip fidelity meterNative XPath searchNothing leaves your browser
Input (XML)
Press Convert.
Elements
0
Attributes
0
Depth
0
Size
0 msCtrl+↵ · Alt+S · Ctrl+Shift+B
Keep going

How it works

1

Drop it in

Paste it, drop a file, or open one: up to 32 MB, UTF-8 or UTF-16. Nothing is converted on arrival — the file waits for you.

2

Set the shape

Attribute prefix, text key, whether a single tag becomes an array, namespaces, empty elements, typed values. These are the settings your consumer actually cares about.

3

Convert

Press Convert, or Ctrl+Enter. Documents over 40 KB go to a Web Worker so the page never freezes, and the fidelity meter reports what the conversion cost.

4

Take it with you

Copy it, download it, or hand it straight to another tool in the suite. Hold Alt at any moment to see the source in place of the result.

Its own parser, not the DOM

The document is scanned into a tree that keeps comments, CDATA sections, processing instructions and the order of mixed content — everything a DOM round trip quietly throws away.

Errors with a line and a column

Every problem is reported where it happens, and the parser keeps going instead of stopping at the first one. Click an issue to send the caret straight to it.

The shape is yours

Attribute prefix, text key, array policy, namespaces, typed values, empty elements. The conventions that decide whether the JSON is usable are settings, not assumptions.

Fidelity you can measure

Every conversion is converted back and compared node by node, so you get a percentage and the exact list of what changed instead of a promise.

XPath 1.0, built in

Query the document with the engine your browser already ships. Match paths and values without exporting anything anywhere.

Big documents stay smooth

Over 40 KB the work moves to a Web Worker. And nothing runs while you type: the conversion waits for the button.

Nothing is uploaded

Parsing, converting and querying all happen in this tab. No server, no telemetry, no file ever leaves the device.

Hands off to the rest of the suite

Send the result straight to JSONFlow, DiffSnap, CodeCard or Hash Bolt without downloading and re-uploading a thing.

xml to json

A converter that admits what it loses

A converter that shows its work: the exact line of every error, the conventions that shape the JSON, and how much of the document survives the trip back.

Everything runs in this tab

Parsing, conversion, XPath and the round-trip check all execute in your browser with plain JavaScript. Documents over 40 KB move to a Web Worker so the interface stays responsive, and nothing is uploaded, queued or logged anywhere.

Built for real documents

Built for real documents

RSS feeds, SOAP envelopes, Android string resources, .NET config files, sitemaps, SVG: documents with namespaces, CDATA and comments, not tidy little examples. The ordered projection reproduces them exactly; the flat one tells you what it had to flatten.

Private by construction

There is no server side to this tool. No account, no upload, no analytics on your content. Close the tab and the document is gone, because local memory was the only place it ever existed.

Frequently Asked Questions

QIs my data sent to any server?+

No. The parser, the converter, the XPath engine and the round-trip check all run inside your browser. There is no server component to send anything to.

QHow are attributes and text handled?+

Attributes take a prefix (@ by default) and an element’s own text goes under a text key (#text by default). Both are editable, so you can match whatever convention your consumer expects — or empty the prefix to merge attributes with child elements.

QWhy did a single element not become an array?+

By default an array appears only when a tag actually repeats, which mirrors the document. If your consumer needs a stable shape, set Arrays to Always, or list the specific tags under Force array.

QWhat does the fidelity percentage mean?+

The result is converted back into the original format and the two trees are compared node by node: elements, attributes, text runs, comments, CDATA and processing instructions. 100% means nothing was lost; anything lower lists exactly what changed.

QCan it keep comments, CDATA and mixed content?+

Yes. Turn on Keep comments and Keep CDATA, and choose the Ordered array policy for documents where the order of text and elements matters, such as XHTML fragments. Ordered is the only projection that round-trips mixed content at 100%.

QHow large a file can I convert?+

Up to 32 MB, in UTF-8 or UTF-16. Above roughly 40 KB the work moves to a Web Worker, so multi-megabyte documents convert without freezing the page. What the tool never does is convert on its own while you type.

Related searches

xml to jsonjson to xmlxml converteronline xml parserxpath testercdataxml namespacesrss to json
Part of the oLoveTools suite
oLoveTools

XML to JSON and back, in your browser, with the losses on the label.

Everything runs in this tab

Parsing, conversion, XPath and the round-trip check all execute in your browser with plain JavaScript. Documents over 40 KB move to a Web Worker so the interface stays responsive, and nothing is uploaded, queued or logged anywhere.

Built for real documents

RSS feeds, SOAP envelopes, Android string resources, .NET config files, sitemaps, SVG: documents with namespaces, CDATA and comments, not tidy little examples. The ordered projection reproduces them exactly; the flat one tells you what it had to flatten.

Private by construction

There is no server side to this tool. No account, no upload, no analytics on your content. Close the tab and the document is gone, because local memory was the only place it ever existed.

xml to jsonjson to xmlxml converteronline xml parserxpath testercdataxml namespacesrss to json

Frequently Asked Questions

Is my data sent to any server?

No. The parser, the converter, the XPath engine and the round-trip check all run inside your browser. There is no server component to send anything to.

How are attributes and text handled?

Attributes take a prefix (@ by default) and an element’s own text goes under a text key (#text by default). Both are editable, so you can match whatever convention your consumer expects — or empty the prefix to merge attributes with child elements.

Why did a single element not become an array?

By default an array appears only when a tag actually repeats, which mirrors the document. If your consumer needs a stable shape, set Arrays to Always, or list the specific tags under Force array.

What does the fidelity percentage mean?

The result is converted back into the original format and the two trees are compared node by node: elements, attributes, text runs, comments, CDATA and processing instructions. 100% means nothing was lost; anything lower lists exactly what changed.

Can it keep comments, CDATA and mixed content?

Yes. Turn on Keep comments and Keep CDATA, and choose the Ordered array policy for documents where the order of text and elements matters, such as XHTML fragments. Ordered is the only projection that round-trips mixed content at 100%.

How large a file can I convert?

Up to 32 MB, in UTF-8 or UTF-16. Above roughly 40 KB the work moves to a Web Worker, so multi-megabyte documents convert without freezing the page. What the tool never does is convert on its own while you type.

© 2026 oLoveToolsAbout

Next step

Format and validate the JSON JSONFlow

XML to JSON | Convert XML to JSON and back

Convert XML to JSON and JSON to XML in your browser. Errors with line and column, configurable attribute and array conventions, native XPath search and a round-trip fidelity meter. Nothing is uploaded.

Converting XML to JSON without pretending it is lossless

XML and JSON do not describe the same universe. XML has attributes, comments, CDATA sections, processing instructions and ordered mixed content; JSON has objects, arrays and four scalar types. Every converter therefore has to choose a mapping, and most of them make that choice silently: an attribute becomes a key with a prefix, an element that happens to appear once becomes a value rather than a list, and the text of an element with children is quietly merged or dropped. This tool makes each of those decisions visible and editable — prefix, text key, array policy, namespace handling, empty elements, typed values — and then converts the result back and compares the two trees so you can see exactly which nodes did not survive.

The practical consequences show up in the everyday documents: an RSS feed whose descriptions live in CDATA, a SOAP envelope where the namespace prefix is part of the contract, an Android strings file where a single translated string is mixed text and markup. For those, the ordered projection keeps the document intact and the round-trip meter reads 100%. For a flat, easy-to-consume shape the same document can be projected with typed values and forced arrays, and the meter will tell you what that convenience cost. Everything runs locally, so a document under NDA is as safe here as it is in your editor, and XPath 1.0 is available on the same page for the moment when the real question is not "convert this" but "where in here is the price over ten".

Frequently Asked Questions

Is my data sent to any server?

No. The parser, the converter, the XPath engine and the round-trip check all run inside your browser. There is no server component to send anything to.

How are attributes and text handled?

Attributes take a prefix (@ by default) and an element’s own text goes under a text key (#text by default). Both are editable, so you can match whatever convention your consumer expects — or empty the prefix to merge attributes with child elements.

Why did a single element not become an array?

By default an array appears only when a tag actually repeats, which mirrors the document. If your consumer needs a stable shape, set Arrays to Always, or list the specific tags under Force array.

What does the fidelity percentage mean?

The result is converted back into the original format and the two trees are compared node by node: elements, attributes, text runs, comments, CDATA and processing instructions. 100% means nothing was lost; anything lower lists exactly what changed.

Can it keep comments, CDATA and mixed content?

Yes. Turn on Keep comments and Keep CDATA, and choose the Ordered array policy for documents where the order of text and elements matters, such as XHTML fragments. Ordered is the only projection that round-trips mixed content at 100%.

How large a file can I convert?

Up to 32 MB, in UTF-8 or UTF-16. Above roughly 40 KB the work moves to a Web Worker, so multi-megabyte documents convert without freezing the page. What the tool never does is convert on its own while you type.

Related searches

xml to json, json to xml, xml converter, online xml parser, xpath tester, cdata, xml namespaces, rss to json