DevBolt
Processed in your browser. Your data never leaves your device.

How do I convert JSON to XML or XML to JSON online?

Paste your JSON or XML, select the conversion direction, and click Convert. JSON objects become XML elements, arrays wrap items in configurable tags, and primitives become text content. XML attributes are preserved with a configurable prefix (default: '@'). Options include XML declaration, CDATA sections, root element name, and indentation. Download as .xml or .json. Everything runs in your browser — your data never leaves your device.

← Back to tools

JSON ↔ XML Converter

Convert between JSON and XML formats. Handles nested objects, arrays, attributes, CDATA sections, and XML declarations.

About JSON ↔ XML Conversion

  • JSON (JavaScript Object Notation) — lightweight data format with objects, arrays, strings, numbers, booleans, and null.
  • XML (Extensible Markup Language) — hierarchical markup format with elements, attributes, namespaces, and CDATA sections.
  • JSON → XML: Objects become elements, arrays wrap items in a configurable tag (default: "item"), primitives become text content. Root element name is configurable.
  • XML → JSON: Elements become keys, repeated sibling elements become arrays, attributes use a configurable prefix (default: "@"), text content uses a configurable key (default: "#text").
  • Swap button carries output to input for round-trip conversion.
  • Everything runs in your browser — no data is sent over the network.

Frequently Asked Questions

How does JSON to XML conversion handle arrays?
JSON arrays are wrapped in a parent element matching the key name, with each array item wrapped in a configurable child element (default: 'item'). For example, {"colors": ["red", "blue"]} becomes <colors><item>red</item><item>blue</item></colors>. You can customize the array item tag name in the options.
How does XML to JSON conversion handle attributes?
XML attributes are preserved in the JSON output using a configurable prefix (default: '@'). For example, <book id="123">Title</book> becomes {"@id": 123, "#text": "Title"}. You can change the attribute prefix or disable attribute preservation entirely in the options.
Does the converter handle CDATA sections?
Yes. In JSON → XML mode, you can enable 'CDATA for special chars' to wrap string values containing <, &, or ]]> in CDATA sections instead of using XML entity escaping. In XML → JSON mode, CDATA sections are automatically parsed and their text content is extracted into the JSON output.
Can I do a round-trip conversion (JSON → XML → JSON)?
Yes. Click the 'Swap & convert back' button to carry the output into the input and switch direction. Note that JSON ↔ XML is not a lossless round-trip — XML attributes, mixed content, and processing instructions have no direct JSON equivalent, so some structural information may change between conversions.

Related Convert Tools