Skip to main content

Convert between XML and JSON objects, using @_ for attributes, #text for text, and preserving numeric strings such as 00123. Explicitly note conversion loss for annotations, CDATA, and mixed content.

Use the "@_" prefix for attributes and "#text" for text; numeric values remain strings. This structural conversion is not a lossless round trip: comments, CDATA tags, and mixed content order may be lost. JSON→XML only accepts single root objects and string values.

62 / 50,000 characters

Shortcut key: Ctrl/⌘+Enter. Modifying inputs or options clears old results.

Instructions for use

  1. Choose XML → JSON or JSON → XML and use the examples in that direction.
  2. Paste the input, check the attributes and root node conventions, and then convert.
  3. Check the output structure, especially arrays, strings, and mixed text, before copying.

Input and output examples

Example input
<root><id>00123</id></root>
Example output
{"root":{"id":"00123"}}

Examples omit typographical white space. 00123 remains as a string and does not become the number 123.

FAQ

XML attributes and subelements may have the same name, and the @_ prefix is used to distinguish attributes. #text represents the text content of the element and still adheres to the same conventions when converted back to XML.

Not guaranteed. The two formats have different expressive capabilities, and current conversions may lose comments, CDATA tags, and mixed content order. The original XML should be retained separately.

A single root object is required, and leaf values use strings; null, Boolean values, and numbers are not automatically guessed into XML semantics. Enter up to 50,000 characters, and reject DTDs and custom entities.

Calculation basis and reference materials

Maps between XML and JSON data structures, preserving string values and representing properties individually. The information models of the two formats are different; mixed text, sequential, and other XML semantics may not be recoverable round-trip.

Content check: · About this site and content description

Related tools