JSON Formatter & Validator
Paste raw JSON to format, validate, or minify it instantly. Errors show the exact line and column.
What is JSON?
JSON (JavaScript Object Notation) is a lightweight data interchange format that's easy for both humans and machines to read. It's the standard for REST APIs, configuration files, and data storage across nearly every programming language.
Common JSON validation errors
- Trailing commas
-
JSON does not allow a comma after the last item in an object or array.
{"name": "test",}is invalid. Remove the trailing comma. - Single quotes
-
JSON requires double quotes for strings.
{'name': 'test'}is invalid. Use"name": "test"instead. - Unquoted keys
-
All object keys must be double-quoted strings.
{name: "test"}is invalid. Use"name": "test". - Missing commas
- Every element in an array or property in an object must be separated by a comma. A missing comma between values will trigger an "unexpected token" error.
- Unescaped special characters
-
Control characters, backslashes, and double quotes inside strings must be escaped.
For example, a literal tab should be
\tand a newline should be\n.
How to use this tool
Paste your JSON into the input area. The tool validates it automatically and shows any errors with the exact line and column number. Use the Format button to pretty-print the JSON with consistent indentation, or Minify to compress it onto a single line.
Press Ctrl+Enter (or Cmd+Enter on Mac) while the input is focused to format instantly.
Format vs minify
- Format (pretty-print)
- Adds indentation and line breaks so the structure is easy to read. Use this when inspecting API responses, debugging configuration files, or reviewing data structures.
- Minify
- Strips all unnecessary whitespace, producing the smallest possible output. Use this when embedding JSON in URLs, storing it in databases, or reducing payload size for API requests.
JSON data types
JSON supports six data types:
- String: text wrapped in double quotes (
"hello") - Number: integers or decimals, no quotes (
42,3.14) - Boolean:
trueorfalse(lowercase, no quotes) - Null:
null(lowercase, no quotes) - Array: an ordered list of values (
[1, 2, 3]) - Object: a collection of key-value pairs (
{ "key": "value" })
Note that JSON does not support comments, undefined, functions, dates (use ISO 8601 strings instead), or single-quoted strings. These are common sources of validation errors when converting from JavaScript objects to JSON.
When you would use this
- Inspecting API responses from
curlor Postman that arrive as a single line - Validating JSON configuration files (package.json, tsconfig.json, terraform plans) before committing
- Debugging webhook payloads or log entries that contain JSON
- Cleaning up JSON before pasting it into documentation or tickets
- Minifying JSON for use in environment variables, URL parameters, or database fields