Data formatting

JSON Formatter & Validator

Format and validate JSON in your browser: pretty-print with 2/4-space or tab indentation, minify, and get line/column-accurate parse errors. Nothing you paste leaves your device.

Free to use · Runs in your browser · No account required

Processed locally in your browser

Nothing you enter here is uploaded, transmitted to a server, or stored by this tool. JSON payloads can still contain personal data — avoid pasting real customer records.

Runs entirely in your browser — nothing is sent to a server

Output

No output yet

Format, minify, or validate JSON above to see the result here.

How to use this tool

  1. 1Paste JSON into the input panel, or load the example to see the format in action.
  2. 2Choose an indentation style — 2 spaces, 4 spaces, or tabs — then click Format.
  3. 3Use Minify to strip whitespace for a compact payload, or Validate to check syntax without changing the input.
  4. 4Copy the result or download it as a .json file. Parse errors show the line and column where reasonably possible.

JSON formatting, minifying, and validation explained

Formatting re-serializes parsed JSON with consistent indentation and line breaks so nested structures are easy to scan. Minifying does the opposite — it removes every character that isn't semantically required, which is useful for reducing payload size over the wire.

Both start the same way: the input is parsed with JavaScript's built-in JSON.parse, which is strict about the JSON spec — no trailing commas, no comments, and object keys must be double-quoted strings. If parsing fails, this tool surfaces the parser's own error message along with the line and column it points to, when the browser's JSON engine reports one.

A numeric limitation worth knowing: JSON itself allows arbitrarily large integers, but JavaScript stores all numbers as IEEE-754 doubles. Integers beyond Number.MAX_SAFE_INTEGER (9,007,199,254,740,991) can silently lose precision when parsed — this is a JavaScript limitation, not a bug in this tool. If you need exact large integers preserved, encode them as strings in your JSON, or parse with a BigInt-aware library server-side.

Frequently asked questions

Does formatting JSON here send my data anywhere?

No. Parsing and formatting run entirely in your browser using the built-in JSON parser — nothing is uploaded.

Why does a large integer look different after formatting?

JavaScript's JSON parser stores numbers as IEEE-754 doubles, so integers beyond 2^53 − 1 (9007199254740991) can lose precision. This tool flags numeric literals near or beyond that limit instead of silently rounding them.

What's the difference between formatting and minifying?

Formatting adds indentation and line breaks for readability. Minifying strips all non-essential whitespace to reduce payload size.

Planned — not yet published

  • Planned
    How to fix invalid JSON: a field guide to parser errorsMaps common `SyntaxError` messages to the exact fix.
  • Planned
    JSON vs JavaScript objects: what's actually differentCovers quoting rules, valid value types, and trailing commas.
  • Planned
    Safely parsing JSON in Node.js without crashing your processtry/catch patterns, size limits, and streaming parsers.