ZapKit

JSON Formatter & Validator

Paste JSON to format it readably, minify it, sort its keys, or find exactly where it's broken. Everything runs in your browser.

What is a JSON formatter?

A JSON formatter, or beautifier, takes JSON that's hard to read, usually because it's been minified onto one line, and adds indentation and line breaks so its structure is clear. A validator checks that it follows JSON's strict syntax and shows where it doesn't.

Developers use this constantly: reading API responses, checking a configuration file before deploying, cleaning up a log entry, or making a payload readable for a bug report. This one also minifies, sorts keys alphabetically, and reports the number of keys, the nesting depth and the size in bytes.

How to use the JSON Formatter

  1. 1.Paste JSON

    An API response, a config file or a log line; minified or messy is fine.

  2. 2.Choose a format

    Two or four spaces, tabs, or minified, and optionally sort keys alphabetically.

  3. 3.Fix or copy

    Errors point to the line and column; valid JSON can be copied or downloaded.

Example: a minified config

The sample one-line JSON on this page, formatted with 2-space indentation:

Valid
yes
Keys
8
Nesting depth
3
Lines after formatting
16

Adding a trailing comma after "csv" makes it invalid, and the error points to that line and column.

Validation that tells you where

The JSON is parsed with the browser's own strict JSON parser, so anything it accepts is valid JSON by the standard (RFC 8259). When it fails, the error is translated into a line and column, which beats hunting for a stray comma in a single 2,000-character line.

Common mistakes are trailing commas, single quotes instead of double quotes, unquoted keys and comments, all allowed in JavaScript but not in JSON. Sorting keys makes two JSON documents easy to compare in a diff tool.

Frequently asked questions

Why is my JSON invalid?

Usually a trailing comma, single quotes, an unquoted key or a comment. The error message points to where the parser stopped.

Is my JSON sent to a server?

No. Formatting and validation happen in your browser, so it's safe for internal data, but avoid pasting secrets anywhere out of habit.

What's the difference between formatting and minifying?

Formatting adds indentation and line breaks for people; minifying removes them to make the file smaller for machines.

How big a file can it handle?

Several megabytes comfortably; very large files depend on your device's memory.

More Developer tools