OneFreePlace / Developer Tools / XML to JSON
Tool #338100% localDTD-safe parserBatch ZIP

XML to JSON

Convert real-world XML into clean JSON without hiding the hard parts. Preserve attributes and namespaces, detect repeated arrays, keep huge numbers exact, inspect mixed content, or switch to a lossless XML infoset model. It can also reverse Tool #337’s lossless typed XML exactly.

VerifiedJSON is parsed again before export
XML input
Paste XML or drop files
Drop XML / SVG / RSS / SOAP files here, or
Verified JSON output
Waiting for input
The output is parsed again locally before copy/download is enabled. DOCTYPE and custom ENTITY declarations are blocked rather than expanded.
Elements—
Attributes—
Namespaces—
Repeated groups—
Mixed content—
Long numbers—
Comments / PI—
JSON size—

Verification & safety audit

Checks that prevent silent corruption and unsafe XML shortcuts.

Mapping signals

Structural details worth reviewing before using the JSON in an API, database or codebase.

Run a conversion to inspect the mapping

Batch files

No files queued.

Mapping controls

Compact mode deliberately exposes the conventions that basic converters usually hard-code.

Structure map

A bounded preview of XML element/attribute paths and how the current profile treats them.

XML pathJSON destination / ruleKind
Convert data to populate the preview.

Three profiles for different jobs

Smart compact JSON

Repeated sibling tags become arrays, attributes stay explicit, and namespace handling is configurable. Best for API and app consumption.

Lossless XML infoset

Preserves element order, qualified names, namespace URIs, attributes, text, CDATA, comments and processing instructions in an explicit node model.

Reverse Tool #337

Recognizes the urn:onefreeplace:json:1 typed vocabulary and reconstructs original JSON types and long numeric tokens exactly.

XML → JSON without pretending the formats are identical

XML has attributes, namespaces, comments, processing instructions and mixed text/element order. JSON has objects, arrays and scalar types. There is no universal one-to-one conversion, so this tool makes the mapping rules visible and offers a lossless model when compact JSON would discard information.

Quick start

  • Paste XML or drop one or more files.
  • Use Smart compact JSON for common API, RSS, SOAP and configuration data.
  • Choose whether attributes use @name keys or a $attributes object.
  • Keep namespace prefixes, use collision-proof Clark names, or strip to local names with collision detection.
  • Use Lossless XML infoset for mixed content, comments, processing instructions or exact namespace semantics.
  • If the XML came from Tool #337’s Lossless typed XML mode, choose Reverse Tool #337 for exact JSON reconstruction.

Huge integers stay huge

<order>
  <id>900719925474099312345</id>
  <paid>true</paid>
</order>

Smart typing →
{"order":{"id":900719925474099312345,"paid":true}}

When smart typing is enabled, numeric text is serialized from the original lexical token instead of first passing through JavaScript floating-point numbers. Leading-zero values such as 00123 remain strings.

Repeated elements and arrays

Repeated sibling elements with the same mapped name become arrays automatically. “Always arrays” makes even single child elements arrays, which can be useful for stable schemas where a tag may repeat later.

Namespaces

Keep prefixes is familiar and readable. Clark names such as {urn:example}item are prefix-independent and collision-safe. Local names only can be convenient, but the tool refuses collisions instead of silently merging elements from different namespace URIs.

Mixed content

Compact JSON stores direct element text under the configured text key, but it cannot perfectly retain interleaving such as text → child → text → child. The audit flags mixed content. Use the lossless infoset profile when order matters.

Security

The parser intentionally rejects DOCTYPE and ENTITY declarations. That avoids custom entity expansion and external-entity behavior rather than trying to be a validating DTD processor. Standard XML entities and numeric character references are decoded normally.

Limits

This is a converter, not an XSD-aware ETL designer. It does not validate against an XSD, execute XSLT/XPath transforms, or fetch external schemas/entities. For schema-to-schema enterprise mappings and automation, specialist mapping software remains appropriate.