JSON to XML Converter

Convert JSON payloads into well-formed XML with configurable root and item tags, attribute prefixes, CDATA sections, and pretty indentation.

Private by architecture: All processing is 100% client-side memory. Your data never leaves this browser tab.
JSON input
0 lines · 0 charsJSON
XML output
0 lines · 0 chars

About This Tool

Transforms JSON objects and arrays into well-formed XML documents with full control over how keys map to elements, attributes, and text nodes.

Configure the attribute prefix (such as @ or _), text content key (#text), root element tag, array item tag name, XML declaration header, and CDATA wrapping.

Key Features

  • Attribute prefix mapping: Any property starting with your chosen prefix (default @, e.g. @id) or nested under @attributes renders as an XML attribute.
  • Text node & CDATA support: Combine attributes and element text using #text (or a custom key), and optionally wrap text values in <![CDATA[...]]> sections.
  • Custom root & array item tags: Set the outer root tag name and the element tag used for root-level or nested arrays.
  • Pretty indent or minified XML: Format with 2 spaces, 4 spaces, tabs, or single-line minified XML with optional <?xml?> prolog.

Frequently Asked Questions

How do I create an XML element with both attributes and text content?
Use an object containing attribute keys prefixed with @ (for example "@currency": "USD") alongside the text node key ("#text": 49.99). That renders as <price currency="USD">49.99</price>.
What happens if a JSON key is not a valid XML tag name?
Characters that are illegal in XML names (such as spaces or punctuation) are replaced with underscores, and keys starting with a digit are prefixed with an underscore so the output remains well-formed XML.
When should I enable CDATA wrapping?
Enable CDATA when string values contain code snippets, HTML markup, or frequent angle brackets and ampersands that you prefer to keep readable without entity encoding.
Is my JSON data sent to any server?
No. Conversion runs entirely inside your browser.