What this site is

JSON & XML Tools is a small utility site with exactly two tools: a JSON formatter, validator and minifier and an XML formatter, validator and minifier. Each one gives you a single editable document, folds it the way a code editor would, and rewrites it in place when you format or minify.

There is no account system, no document history and no server-side processing. That is a deliberate design decision rather than a missing feature: the fastest and safest way to handle a document you do not want to share is to never send it anywhere.

Why everything runs in your browser

Documents pasted into a formatter are often exactly the ones you should not email to a stranger: API responses with tokens, internal configuration, customer exports. A tool that posts that content to an unknown server asks you to take a lot on trust.

Both tools here are plain client-side JavaScript. Formatting, validation and minifying run in the page you already have open. You can verify this with your browser's network panel — no request carries your document. It also means the tools keep working after your network connection drops.

What each tool checks

JSON

The JSON validator enforces JSON as defined by RFC 8259 and ECMA-404: a single top-level value, double-quoted keys, no trailing commas or comments, correctly escaped strings and well-formed numbers.

Formatting is implemented by re-indenting the original text rather than by parsing and re-printing it. That distinction matters — a parse-and-print round trip normalises 1.0 to 1, rewrites 1e3 as 1000, loses precision above 253 and collapses duplicate keys. Re-indenting changes only whitespace outside string literals, so your data survives intact.

XML

The XML validator checks well-formedness: correctly matched and nested tags, quoted attribute values, exactly one root element, terminated comments, CDATA sections, processing instructions and DOCTYPE declarations, and escaped markup characters in text.

Formatting preserves every tag as written, including attribute order and quote style, and never touches CDATA content. The formatting rules are documented in full on the XML tool page so there are no surprises.

Deliberate limitations

  • No schema validation. Neither tool validates a document against an XSD, DTD, Relax NG schema or JSON Schema. They tell you whether a document is syntactically valid, not whether it matches your contract.
  • No JSON5, JSONC or YAML. Comments and trailing commas are rejected rather than tolerated, because that is what makes a validator useful.
  • No XML namespace resolution. Namespace prefixes are preserved exactly as written and are never resolved, rewritten or validated against a namespace declaration.
  • No server-side conversion. There is no JSON-to-XML or XML-to-JSON conversion, because doing it well requires a mapping decision that only you can make.

How it is built

The site is a statically generated Astro project, which means every page is plain HTML with no server rendering at request time. The editor is CodeMirror 6, chosen because it provides genuine editor-level folding through its syntax tree rather than a simulated collapse. XML formatting, minifying and well-formedness checking are all handled by a purpose-built tokenizer in this project, so that no part of a tag is ever reinterpreted and every diagnostic can be reported with an exact line and column.

The visual design follows a documented token set for colour, type, spacing, radii and motion. Every text and interface colour pair is checked against WCAG 2.1 AA contrast thresholds in an automated test, in both light and dark themes.

Feedback

Found a document that formats incorrectly, or a case the validator gets wrong? Please get in touch and include the smallest input that reproduces it.