XML to JSON Converter

Paste XML, get clean JSON — attributes, repeated elements and text nodes handled correctly

Input XML

Node Details

Select a node to view details

More JSON Tools

JSON Formatter

Format, validate, and explore JSON — 100% client-side, private by design

XML to JSON ●

Paste XML, get clean JSON — attributes, repeated elements and text nodes handled correctly

CSV to JSON

Turn CSV rows into JSON arrays of objects — quoted fields, custom delimiters and types handled for you

JSON to CSV

Flatten nested JSON into clean CSV columns — download Excel-ready .csv files in one click

JSON Minifier

Compress JSON to a single line and watch exactly how many bytes you save

JSON Diff

Compare two JSON documents semantically — key order and whitespace never count as differences

JSON Escape

Escape JSON strings for embedding — or unescape stringified logs back into readable JSON

JSON Fixer

One-click repair for broken JSON, JSON5, JS objects, Python dicts and truncated LLM output.

JSON to TypeScript

Turn any JSON payload into clean TypeScript interfaces or type aliases — merge arrays, detect optional fields and unions.

YAML to JSON

Parse YAML configs — K8s, Docker Compose, GitHub Actions — into clean JSON, then explore and edit visually.

JSON to YAML

Generate clean, idiomatic YAML from any JSON — smart string quoting, compact list style, 2 or 4 space indent.

JSON to XML

Serialize JSON to well-formed XML — @_ attributes, repeated elements, text nodes and safe tag names.

JSON Schema

Infer a standards-compliant JSON Schema from example data — formats, required keys, unions and additionalProperties control.

JSONPath Tester

Query any JSON with live JSONPath evaluation — wildcards, recursive descent, slices and filters, all in your browser.

Key Features

Smart Attribute Handling

XML attributes map to JSON keys with a configurable prefix (default @_). Prefer plain values only? Flip on "Ignore attributes" in one click.

Repeated Elements → Arrays

Sibling elements that share a tag name are automatically aggregated into JSON arrays, so lists survive the conversion faithfully.

Automatic Type Inference

Numeric and boolean strings such as "42" or "true" become real JSON numbers and booleans. Turn it off to keep everything as strings.

Instant Tree & Table Preview

The converted JSON renders immediately in the interactive tree, table, and text views — inspect, edit inline, then copy or download.

How to Use XML to JSON Converter

1

Paste Your XML

Copy an XML document or fragment and paste it into the input panel, or upload a .xml file. Click "Sample" to see a working example.

2

Adjust Conversion Options

Pick an attribute prefix (default @_), decide whether to keep attributes, and toggle primitive parsing for numbers and booleans.

3

Convert and Export

Click "Convert to JSON". The result appears in tree, table, or text view — copy it to the clipboard or download it as a .json file.

Technical Architecture & Privacy Comparison

How formatjson.net compares to traditional server-based JSON formatters and converters

100% Client-Side Execution Zero Server Upload RFC 8259 & RFC 4180 Compliant IEEE-754 64-Bit Int Safe JSON Schema 2020-12 Offline-Ready PWA
Capability / Standard formatjson.net (Client-Side Workbench) Traditional Server-Based Tools
Data Processing & Privacy 100% local in-browser JavaScript — payloads never leave your device Often uploads JSON/XML/CSV to remote backend servers
Confidential API Keys, JWTs & PII Safe by design — zero network transmission, works offline via Service Worker Risk of server access logs or third-party data retention
Broken & Truncated LLM JSON Repair 1-click lexical state machine fixes comments, single quotes, trailing commas, Python literals & unclosed brackets Fails with syntax error on non-strict JSON
64-Bit Snowflake IDs & Leading Zeros Preserves unsafe integers (> 2^53 - 1) and leading-zero codes ("00123") without precision loss Silently truncates 64-bit IDs or strips leading zeros
Deep Nested Array Exploration Interactive spreadsheet drill-down ([n items] →) with breadcrumbs, 3-state sorting & inline cell editing Flat root-only tables or read-only trees
Large File Responsiveness Chunked lazy tree (200 nodes/batch) + paginated table + 150 KB highlight guard Main-thread DOM freeze on multi-megabyte files

Frequently Asked Questions

How does the XML to JSON converter handle XML attributes? ▾

Attributes are converted into regular JSON properties whose names are prefixed ("@_id" by default, configurable). Elements that have both attributes and text keep the text under a "#text" key. You can also ignore attributes entirely with the options toggle.

How are repeated XML sibling elements converted into JSON? ▾

Sibling elements sharing the same tag name — like multiple <item> or <book> nodes — are automatically grouped into a JSON array. Single occurrences stay as plain objects or values, keeping the output clean.

Are XML text nodes and mixed content preserved during conversion? ▾

Yes. An element containing only text becomes a JSON string (or a number/boolean when type inference is on). When an element has both children and text, the text is stored under the "#text" property so nothing is lost.

Is my XML file uploaded to any server? ▾

No. Conversion runs entirely in your browser using the native DOMParser API. Your XML — including confidential feeds or internal schemas — never leaves your machine.

Can I view and edit the converted JSON in a tree or table view? ▾

Yes. The output feeds straight into the full JSON workbench: expand it in the tree, inspect arrays of repeated elements in the table, edit values inline in the details panel, then copy or download the result.