← All tools
// Data

JSON Formatter online

Format, validate, and minify JSON — instant syntax error detection

JSON Formatter logo
by
CHUNKY
MUNSTER
// Paste your JSON
// Output
Output will appear here...
Keys
Max depth
Size (bytes)

How to Use json-format

  1. Paste JSON into the input area.
  2. Click Format to indent and pretty-print the JSON with collapsible tree view.
  3. Click Minify to produce single-line, whitespace-free JSON.
  4. The validator highlights syntax errors with line and column numbers.

JSON is the universal data interchange format — used in REST APIs, configuration files, NoSQL databases, and frontend frameworks. This formatter validates, pretty-prints, and minifies JSON in your browser. It catches syntax errors precisely (indicating the exact line and column), handles Unicode correctly, and can sort keys alphabetically for easier comparison and diffing.

JSON Validation: Common Errors

The most frequent JSON syntax errors: trailing commas after the last element in an array or object (valid in JavaScript, forbidden in JSON); unquoted property names ({name: "value"} is invalid JSON, {"name": "value"} is correct); single quotes instead of double quotes; comments (JSON has no comment syntax); and undefined or NaN values (JSON only supports null, not undefined/NaN). The validator pinpoints the first error and its location.

Frequently Asked Questions

Why doesn't JSON support comments?

Douglas Crockford (JSON's creator) deliberately excluded comments. He later explained that he removed them because people were using comments to include parsing directives — defeating the goal of a simple, universal data format. JSONC (JSON with Comments) is a non-standard extension used by VS Code and TypeScript configs.

What is the difference between JSON and JavaScript object notation?

JSON is a strict subset of JavaScript literal syntax with additional restrictions: keys must be double-quoted strings, undefined and functions are not valid values, trailing commas are forbidden, and NaN/Infinity are not supported. Valid JSON is valid JavaScript, but not vice versa.

What are the valid JSON data types?

String (double-quoted), Number (integer or floating-point, no hex/octal), Boolean (true/false), null, Array ([...]), and Object ({...}). Dates, undefined, functions, and regular expressions are not JSON types.

How do I handle very large JSON files in the browser?

The browser's JavaScript engine handles JSON up to the available memory — typically tens to hundreds of MB. For very large files (>100 MB), processing may slow. For multi-GB JSON, use a streaming parser like jq or Python's ijson at the command line.

See also JSON to CSV, JSON to YAML, XML to JSON, and the full data format toolkit.

📖 Reference: RFC 8259 — The JavaScript Object Notation (JSON) Data Interchange Format