All Tools
Categories
Email Marketing Tools 55 Import-Export Tools 50 XML Tools 19 Text Tools 12 Shipping Freight Tools 5 Calculator 4 Marketing Tools 3 Encoder Tools 1
About Contact Privacy

Convert XML to JSON

Free XML to JSON converter that maps elements, attributes, text and repeated nodes into a clean JSON structure. Control the attribute prefix, text key, arrays and number parsing, then copy or download the result. Runs entirely in your browser.

Input
Arrays even for single occurrences
Output

About Convert XML to JSON

JSON and XML are different shapes of the same idea, and moving between them is a routine part of API work, data pipelines and migrations. Convert XML to JSON builds a clean, predictable JSON structure from your document: elements become objects, attributes become prefixed keys, text becomes a designated key, and repeated nodes become arrays.

The mapping rules are fully configurable so the output fits your conventions — choose the attribute prefix, the text key, whether numbers are parsed, and whether arrays are used everywhere. The result is pretty-printed with your chosen indentation, ready to copy, download or print. Everything happens locally in your browser.

Features

  • Deterministic mapping: elements to objects, attributes to prefixed keys, text to a text key, repeats to arrays.
  • Configurable attribute prefix: default @, changeable to fit your team conventions.
  • Configurable text key: default #text, including the option to omit it for pure-text elements.
  • Automatic arrays for repeats: repeated elements become arrays; singletons stay scalars.
  • Force-array option: wrap every element in an array when downstream code expects uniform shapes.
  • Numeric parsing: turn numeric-looking strings into real JSON numbers.
  • CDATA and text merged correctly within their element.
  • Pretty-printed output with your choice of indentation.
  • Copy, download or print: the JSON is a click from your clipboard.
  • Private by design: no uploads, no logs.

How to Use

  1. Paste your XML or load it from a file.
  2. Configure the mapping — attribute prefix, text key, numeric parsing and array handling.
  3. Pick the indentation for the JSON output.
  4. Review the result and adjust options until the shape matches your expectations.
  5. Copy or download the JSON, or print it to PDF.

Examples

Example 1 — API integration. A legacy partner delivers XML; your services speak JSON. Convert with the attribute prefix and numeric parsing set to match your API contract, and paste the result into your test fixtures.

Example 2 — Data migration. Moving a content export from an XML format to a document store means mapping records to JSON. The array options let you produce exactly the nested shape the store expects.

Example 3 — Inspection and debugging. Curious what a vendor feed actually contains? Convert it once and read the JSON tree instead of wading through angle brackets.

Example 4 — Configuration portability. XML configs converted to JSON slot directly into tools and frameworks that only read JSON, with the attribute prefix giving you a stable convention.

Benefits

  • Clean, predictable output — the mapping rules are explicit and configurable.
  • No information loss — attributes, text and repeats all represented.
  • Fits your conventions — prefix, text key, arrays and numbers are your choice.
  • Instant and free — paste, convert, copy, done.
  • Private by design — local conversion, nothing uploaded.

Frequently Asked Questions

How are XML attributes handled?
Attributes become keys in the element object, prefixed by default with @ (for example <a id="x"> becomes {"@id":"x"}). The prefix is configurable so you can fit whatever JSON convention your team uses.
How is text content represented?
Text inside an element becomes a key (default "#text") on the element object. If an element contains only text with no attributes or children, the value is returned as a plain string instead.
How are repeated elements handled?
By default, repeated child elements become arrays. If the array option is off, elements still become arrays when they repeat, but a single occurrence stays a single value. Enabling the option wraps every element in an array regardless.
Can I get numbers instead of strings?
Enable the numbers option and numeric-looking text is converted to JSON numbers. Attributes and text values are both parsed, so "249.99" becomes 249.99 rather than "249.99".
Does the conversion lose information?
The structural mapping is lossless for typical documents: every element, attribute and text node is represented. The only deliberate losses are whitespace-only text and the XML declaration, both of which JSON cannot represent.