JSON WORKSPACE
XML to JSON
Convert XML to an explicit ordered JSON structure.
Input is processed on this site only when you run the tool. The application does not save inputs or results.
input.txt
Result result.json
A little clarity goes here.
Run the tool to see your result.
Result preview
UTF-8 text, at most 65536 bytes per input. Tab leaves the editor. Plain text disables syntax colors. Browser textareas may normalize line endings to LF.
{"convert":{"inputMode":"text","options":[],"inputLabels":[],"inputLimits":[]}}{"convert":{"input":"<item id=\"7\">Hello <b>world<\/b>!<\/item>","options":[]}}A QUICK WALKTHROUGH
A familiar workflow,
with room to focus.
Paste UTF-8 XML 1.0 without DTDs or entity declarations.
Convert to explicit element, attribute and ordered child records.
Inspect qualified names, namespace URIs and mixed content before copying.
When to use XML to JSON
Inspect an XML message as ordered JSON records without guessing whether repeated elements should become scalar values or arrays.
Read the result
Names, attributes and ordered child records make mixed content explicit. This is a structural inspection mapping, not a promise that converting the JSON back will reproduce original XML bytes.
SEE IT IN PRACTICE
Worked examples
Sample input. A result you can inspect.
Convert example
Input
<item id="7">Hello <b>world</b>!</item>
Expected result
{"type":"element","name":"item","namespace":"","attributes":[{"name":"id","namespace":"","value":"7"}],"children":[{"type":"text","value":"Hello "},{"type":"element","name":"b","namespace":"","attributes":[],"children":[{"type":"text","value":"world"}]},{"type":"text","value":"!"}]}{"kind":"code","title":"Converted JSON","code":"{\n \"type\": \"element\",\n \"name\": \"item\",\n \"namespace\": \"\",\n \"attributes\": [\n {\n \"name\": \"id\",\n \"namespace\": \"\",\n \"value\": \"7\"\n }\n ],\n \"children\": [\n {\n \"type\": \"text\",\n \"value\": \"Hello \"\n },\n {\n \"type\": \"element\",\n \"name\": \"b\",\n \"namespace\": \"\",\n \"attributes\": [],\n \"children\": [\n {\n \"type\": \"text\",\n \"value\": \"world\"\n }\n ]\n },\n {\n \"type\": \"text\",\n \"value\": \"!\"\n }\n ]\n}","copyRaw":true,"schema":1}Formats, limits and common errors
Malformed XML, non-UTF-8 declarations and entities are rejected without quoting your data.
- No DTD loading, entity substitution, schema validation, XInclude processing or network access. Declaration tokens are rejected even inside comments/CDATA.
- At most 32 element levels, 5,000 nodes including attributes, and 64 attributes per element.
- Text, CDATA, comments and processing instructions within the root retain their order. Outside-root comments/PIs are omitted. XML normalization follows libxml; no type inference or round-trip XML promise.
- Input: 65,536 UTF-8 bytes per text field. Output: at most 524,288 UTF-8 bytes; serialized responses have a separate 1 MiB ceiling. Size/work failures return no partial result.