Skip to content

JSON formatter that never uploads your data

Beautify, minify, and validate JSON in the browser.

Runs entirely in your browser. Nothing you type is sent to a server.
Running locallyDeveloper Tools
Result
Click Format or Minify to see your result.
Short answer

This formats, validates and minifies JSON entirely in your browser — which matters more for JSON than for most formats, because JSON payloads routinely contain API keys, access tokens, customer records and internal identifiers. Pasting that into a server-side formatter means handing it to a third party. Here the parse happens in your tab and nothing is transmitted. Validation uses the browser's own JSON.parse, so what passes here is exactly what any standards-compliant parser accepts, and errors report the character position where parsing failed. The strictness catches the usual culprits: trailing commas, single-quoted strings, unquoted keys and JavaScript comments are all invalid JSON even though they look reasonable. Minifying strips whitespace only and typically cuts 15 to 30 percent from a formatted payload. Very large documents are limited by tab memory, since the whole structure is held at once.

Overview

About the JSON Formatter

Format, minify and validate JSON without uploading it anywhere. That matters more for JSON than for most formats, because real payloads routinely carry API keys, access tokens and customer records — here the parse happens in your browser tab and nothing is transmitted.

Procedure4

How to use the JSON Formatter

  1. 01Paste your raw or messy JSON into the input area.
  2. 02Click "Format" for indented, human-readable JSON.
  3. 03Click "Minify" to strip whitespace and shrink it to one line.
  4. 04Use "Copy" to send the cleaned result to your clipboard.
Capabilities4

Why use our JSON Formatter

  • 01

    Beautify with indentation

    Pretty-print with 2-space indentation for readability and code reviews.

  • 02

    One-click minify

    Strip every whitespace character to make payloads as small as possible.

  • 03

    Real validation

    Catches syntax errors and tells you what went wrong in plain English.

  • 04

    Private by design

    Parsing happens locally with JSON.parse — your data never touches a server.

Detail

Why is my JSON invalid?

JSON is a deliberately strict format and most errors come from a small set of causes. Trailing commas after the last element of an array or object are invalid, even though JavaScript object literals permit them, and this is the single most common mistake. Keys must be double-quoted strings — unquoted keys and single-quoted strings are both JavaScript syntax rather than JSON. Comments are not permitted at all, which surprises people using JSON for configuration files, and is why formats like JSON5 and JSONC exist. Numbers cannot have leading zeros, cannot be NaN or Infinity, and must use a dot as the decimal separator. Undefined is not a value; null is. When a parser reports an error it gives the character position where parsing failed, which is usually just after the actual mistake rather than at it — a missing comma is reported at the start of the next token. Reading the error position and then looking at what precedes it is the reliable technique.

Detail

Formatting versus minifying, and where each belongs

The two operations serve opposite purposes and neither changes the data. Formatting adds indentation and line breaks so the structure is visible, which is what you want when reading an API response, debugging a payload or reviewing a configuration file in version control — a formatted file also produces meaningful line-by-line diffs, whereas a minified one shows the entire document as a single changed line. Minifying strips every unnecessary space and newline, which is what you want when transmitting: on a large payload it commonly saves 10 to 30 percent of the bytes. In practice, HTTP compression makes much of that saving redundant, since gzip and brotli collapse repeated whitespace extremely efficiently, so minified JSON over a compressed connection often gains only a few percent over formatted JSON. The pragmatic position is to store and commit formatted JSON for readability and diffability, and let the transport layer handle compression rather than minifying by hand.

Detail

Large payloads, key order and numeric precision

Three behaviours catch people out. First, key order: the JSON specification says objects are unordered collections, but every mainstream parser preserves insertion order in practice, and formatting here does not reorder keys. Do not rely on order for correctness, but do not expect it to be scrambled either. Second, numeric precision. JSON numbers are parsed into IEEE 754 double-precision floats, which represent integers exactly only up to 2^53 − 1. A 64-bit database identifier or a Twitter-style snowflake ID exceeding that will be silently rounded, changing the value — which is why APIs handling large IDs send them as strings. If a formatted number differs from what you pasted, this is why, and the fix is to quote it at the source. Third, size: parsing happens in memory, so a very large document can make a tab unresponsive. For multi-hundred-megabyte files, a streaming command-line tool is the right instrument.

Reference6

Common JSON errors

MistakeInvalidValid
Trailing comma{"a": 1,}{"a": 1}
Unquoted key{a: 1}{"a": 1}
Single quotes{'a': 1}{"a": 1}
Comment{"a": 1} // note{"a": 1}
Undefined value{"a": undefined}{"a": null}
Leading zero{"a": 007}{"a": 7}

Parsers report the position where parsing failed, which is typically just after the actual mistake.

Questions9

Frequently asked questions

Is my JSON uploaded to a server?

No. Parsing, formatting and validation all run in your browser. That matters because JSON payloads often carry tokens, keys and personal data.

Why is my JSON invalid when it looks fine?

Most often a trailing comma, an unquoted key, single quotes or a comment. All four are valid JavaScript and invalid JSON.

Can JSON contain comments?

No. The specification has no comment syntax, which is why JSON5 and JSONC exist for configuration files that need them.

Why did my large number change?

JSON numbers parse as IEEE 754 doubles, which are exact only up to 2^53 − 1. Larger integers such as 64-bit IDs get rounded — APIs handling them should send them as strings.

Does formatting change my data?

No. Only whitespace changes. Keys, values, types and order are all preserved exactly.

Should I minify JSON to save bandwidth?

Usually not worth doing by hand. gzip and brotli compress whitespace very efficiently, so minifying over a compressed connection often gains only a few percent.

Is key order guaranteed?

The specification says objects are unordered, but every mainstream parser preserves insertion order. Do not depend on it for correctness.

How large a file can it handle?

It parses in memory, so very large documents can make a tab unresponsive. For files in the hundreds of megabytes, use a streaming command-line tool.

What does the error position mean?

The character index where parsing failed. The actual mistake is usually just before it — a missing comma is reported at the start of the next token.

Last updated

JSON syntax per RFC 8259 and ECMA-404. Numeric precision limits follow IEEE 754 double-precision as used by JavaScript's JSON.parse.