<!-- Markdown version of https://ocxly.com/json-formatter.html · auto-generated, may lag the live page -->

# JSON Formatter & Validator

Paste JSON, get it back clean and validated. Beautify or minify, sort keys, and when something's wrong, see exactly where — line, column, and a caret pointing at the problem. Everything runs in your browser; nothing is uploaded.

## What this validates

This tool checks your input against the JSON specification (RFC 8259) — the same rules every parser enforces. It uses a hand-written parser rather than the browser's built-in `JSON.parse`, which lets it report the exact line and column of the first error in every browser. Safari's native parser, for instance, often won't tell you *where* a problem is; this one always will.

### The mistakes it catches

The most common JSON errors are simple and avoidable once you can see them: **trailing commas** (valid in JavaScript, forbidden in JSON), **single quotes** instead of double quotes, **unquoted keys**, **missing commas** between items, **unterminated strings**, and **comments** (JSON has none). For each, the tool shows a plain-language message and a caret pointing at the offending character.

### Format, minify, sort

**Format** pretty-prints with your chosen indent (2 spaces, 4 spaces, or tabs) so structure is readable. **Minify** strips all insignificant whitespace for the smallest possible payload — useful before sending JSON over the wire. **Sort keys** alphabetises object keys recursively, which makes diffing two JSON files far easier and produces deterministic output.

### Privacy

Everything happens in your browser. Your JSON is never sent to a server, logged, or stored. You can disconnect from the network and this page will keep working — paste a config file or an API response with confidence that it stays on your machine.

## Accessibility

### Screen reader support

---
*Source: [ocxly.com/json-formatter.html](https://ocxly.com/json-formatter.html) — OCXLY, free 100% client-side privacy-first tools. Format, validate, and beautify JSON in your browser — free, no install. Supports minify, syntax highlighting, and error detection. OCXLY Tools.*
