JSON Formatter & Validator
Pretty-print, minify, and validate JSON with error line/column reporting. Runs entirely in your browser.
JSON (JavaScript Object Notation) is a text format for structured data built on double-quoted strings, numbers, booleans, null, arrays, and objects. It is the default interchange format for nearly every modern API.
JSON builds data from six value types: objects (key-value pairs), arrays (ordered lists), and the primitives string, number, boolean, and null. Objects and arrays nest to any depth, so one document can represent anything from a single configuration file to a deeply structured API response, and the formatter keeps that hierarchy readable by indenting each level to match its nesting depth.
Common JSON errors include trailing commas, single quotes, unquoted keys, and missing brackets. The validator reports the line and column so you can fix the source instead of guessing from a generic 'unexpected token' message.
JSON does not allow trailing commas, single quotes, or comments. The validator points to the exact line and column so you can fix the source instead of guessing.
Common uses
- Inspecting an API response by turning one long line of JSON into readable, indented output before reading it or sharing it.
- Preparing a JSON payload for a database or cache by minifying it to remove whitespace and reduce size.
Frequently asked questions
- What is the difference between minify and pretty print?
- Pretty print adds indentation and line breaks for readability. Minify removes all unnecessary whitespace and newlines to produce the smallest valid JSON.
- Does JSON allow comments?
- No. JSON is a strict subset of JavaScript object literal syntax and does not allow // or /* */ comments. Tools like JSON5 and JSONC extend JSON for this purpose.
- Is JSON the same as a JavaScript object?
- No. JSON requires double quotes around keys and strings, has no trailing commas, and has no methods or undefined. Valid JS objects are not always valid JSON.