Processed in your browser

JSON / XML Converter

Use @attributes for XML attributes and #text for element text. Repeated child elements become arrays. DTD and entity declarations are rejected before the browser XML parser runs.

Processed in your browser
0 / 1,000,000
Converted output

Tool guide

What is JSON / XML Converter?

JSON and XML Converter uses explicit mappings: attributes live under @attributes, element text under #text, and repeated sibling elements become arrays. DTD and entity declarations are rejected to reduce external-entity risk. Comments, mixed content, and namespace details that cannot round-trip perfectly are clearly identified. Common workflows include the following. Create simple XML requests for a legacy integration. Convert structured XML into JSON for frontend processing. Understand how attributes, text, and repeated elements map between formats. The page also documents input boundaries, output behavior, and practical cautions so you can review the result before putting it into an application, configuration, test, or production workflow.

When to use it

  • Create simple XML requests for a legacy integration.
  • Convert structured XML into JSON for frontend processing.
  • Understand how attributes, text, and repeated elements map between formats.

How to use it

  1. Paste JSON with one root key, or an XML document.
  2. Choose the conversion direction.
  3. Review mapping warnings before copying or swapping the result.
  4. Load one of the realistic examples first to verify the selected options and processing direction before replacing it with your own data.
  5. Review the output, status message, and documented limits; copy, download, or continue only after the result matches your expectation.

Runnable examples

The “Example 1” and “Example 2” buttons load the matching inputs. They cover different structures, directions, or boundaries and can be run directly in the workspace.

Example 1

{"catalog":{"@attributes":{"lang":"en"},"tool":[{"@attributes":{"id":"21"},"#text":"Case converter"},{"@attributes":{"id":"22"},"#text":"Letter case tool"}]}}

Example 2

<release version="1.5"><tools><tool id="19">Line deduplicator</tool><tool id="20">Regex tester</tool></tools><ready>true</ready></release>

Input rules

  • JSON-to-XML input must contain exactly one root key.
  • XML must be well formed and cannot contain DTD or ENTITY declarations.
  • Complex mixed content, instructions, and namespaces require manual review.
  • Text input is counted before processing and is limited to 1,000,000 characters on this page; file modes apply the separate file limit shown in the workspace.
  • JSON to XML requires exactly one root object key.

Output rules

  • Attributes map to @attributes and text maps to #text.
  • Repeated sibling elements become arrays.
  • Output is formatted, but complex XML is not guaranteed to round-trip without loss.
  • Output reflects only the current input, direction, and options; rerun after changing a mode or value instead of treating an earlier result as current.
  • Mixed #text and child elements are rejected in the JSON-to-XML direction.

Limitations and cautions

  • JSON to XML requires exactly one root object key.
  • Mixed #text and child elements are rejected in the JSON-to-XML direction.
  • Comments, processing instructions, prefixes, and some namespace semantics are not preserved.

How your data is handled

XML parsing and conversion happen locally and do not load external entities or remote resources.

FAQ

How are XML attributes represented?

They are stored in an @attributes object; element text uses #text.

Are external entities allowed?

No. DTD and ENTITY declarations are explicitly rejected, and no network requests are made.

Is every XML document lossless?

No. Comments, processing instructions, mixed-content order, prefixes, and some namespace details may not round-trip.

How are XML attributes and text mapped?

Attributes go into @attributes, element text uses #text, and repeated sibling elements become arrays.

Why are DTD and ENTITY declarations rejected?

External entities can read resources or cause expansion attacks. The local parser rejects those declarations.

Is a round trip always lossless?

No. Simple structures are predictable, but comments, namespace details, processing instructions, and mixed content may not round-trip exactly.

Updated: 2026-07-31