XML Validator
Check XML is well-formed and find the exact tag that breaks it.
Convert XML into clean JSON, with attributes and text handled predictably.
The XML to JSON converter maps attributes to @-prefixed keys, element text to #text or to the value directly, and repeated tags to arrays — the conventions most libraries use, applied visibly rather than silently.
Turning XML into JSON means answering three questions that have no single right answer, and this converter answers them the way most libraries do — visibly, so you are not surprised. Attributes become keys prefixed with @. An element's own text sits under #text when it also has children, and becomes the value directly when it does not.
A tag that appears once becomes a single value; the same tag repeated becomes an array. That is the behaviour that catches people out, because a document with one <item> and a document with three produce different JSON shapes. Type detection is optional: with it on, "42" becomes the number 42 and "true" becomes a boolean, which is usually what you want and occasionally is not.
The @ prefix keeps an attribute separate from a child element of the same name, which is otherwise a silent data loss.
The same tag twice produces an array. A tag appearing once cannot, which is a difference worth knowing before your code depends on it.
An element with both text and children keeps its text under #text rather than discarding one or the other.
Turn it on for real numbers and booleans, or off when a value such as 0700 must keep its leading zero.
A prefixed name such as soap:Body becomes the key "soap:Body", so nothing is quietly stripped.
A feed, a SOAP response, a config file or an export.
Choose the attribute prefix and whether to keep attributes at all.
Leave detection on for real numbers and booleans, or off to keep every value as a string.
The result is formatted and ready to paste into code or a test.
Because XML cannot express "this is a list of one". A tag appearing once becomes a value and the same tag repeated becomes an array — so code reading the result should handle both.
They become keys on the same object, prefixed with @ so they never collide with a child element of the same name. You can turn them off entirely.
Under the #text key when the element also has child elements or attributes. When it has neither, the text becomes the value directly.
Yes, as part of the key. An element named soap:Body becomes the key "soap:Body" rather than being stripped, so nothing is silently lost.
What people who use the XML to JSON think of it. Reviews come from visitors and are posted as written.
No ratings yet
Yours would be the first.
0 reviews
Newest first
No reviews yet
Be the first to rate the XML to JSON. It takes half a minute and no account.
Write the first reviewCheck XML is well-formed and find the exact tag that breaks it.
Re-indent HTML without breaking whitespace-sensitive elements.
Compare two semantic versions and test them against a range.
Convert JSON to clean, correctly quoted YAML in one step.
Encode and decode Base32, including the Crockford and hex variants.
Fill in the fields and get a complete README.md in Markdown.
Generate the border trick that makes triangles and tooltip arrows.
Fix broken JSON: trailing commas, single quotes, unquoted keys and comments.