JSON Formatter & Validator

Format, validate, minify, and inspect JSON — all in your browser.

100% local — your data never leaves this tab
Input JSON 0 bytes
Ready — paste JSON to begin
Output 0 bytes

Common JSON errors and how to fix them

Error patternProblemFix
{"key": "value",}Trailing comma after last itemRemove the comma before the closing brace or bracket
{'key': 'value'}Single quotes instead of double quotesReplace all single quotes with double quotes around keys and string values
{key: "value"}Unquoted keyWrap the key in double quotes: {"key": "value"}
// commentComments not supported in JSONRemove all comments — JSON has no comment syntax
undefined, NaN, InfinityJavaScript-only values not valid in JSONReplace with null or a valid number
{name: undefined}undefined valueUse null or omit the key entirely
"date": 2024-01-01Unquoted date stringWrap in quotes: "date": "2024-01-01"

JSON data types

JSON supports exactly six data types:

{ "string": "hello world", "number": 42, "float": 3.14, "boolean": true, "null": null, "array": [1, 2, 3], "object": {"key": "value"} }

Privacy first: This tool processes everything locally in your browser. Sensitive API keys, tokens, user data, and credentials in your JSON never leave your device. Safe for internal and confidential data.

What each action does

Format (Pretty-print)

Adds consistent indentation and line breaks to make nested JSON human-readable. Choose 2 spaces, 4 spaces, or tabs as the indentation style. Also validates the JSON and reports any errors before formatting.

Minify

Removes all whitespace (spaces, tabs, newlines) that isn't inside a string value. Produces the smallest possible valid JSON string — useful for API payloads, config files shipped with applications, and any situation where file size matters.

Validate only

Checks whether the input is valid JSON without changing it. Reports the exact line and character position of any errors. Useful when you want to confirm correctness without reformatting.

Sort keys

Reformats the JSON with all object keys sorted alphabetically at every level. Useful for comparing two JSON objects, normalising output for version control, or making large objects easier to scan.

Frequently asked questions

Yes. Processing happens entirely in your browser — your JSON is never sent to any server and is not stored or logged anywhere. You can safely paste API keys, tokens, passwords, and confidential data. Close the tab and no trace remains.
JSON was designed for strict machine-to-machine data exchange and follows a very conservative grammar. Trailing commas were deliberately excluded to keep parsers simple and predictable across all platforms. JavaScript itself does allow trailing commas in objects and arrays, but JSON (despite sharing the same syntax visually) is a separate, stricter format.
JSON is a text format for data exchange, not code. Key differences: JSON requires double quotes around all keys and string values (JavaScript objects allow unquoted keys and single quotes). JSON has no undefined, NaN, Infinity, functions, or Date objects. JSON is a strict subset of what JavaScript can represent.
No. Standard JSON does not support comments of any kind. If you need a config file format that supports comments, consider JSONC (JSON with Comments — used by VS Code), JSON5, HJSON, or TOML. If your file has // or /* */ comments, remove them before parsing as JSON.
Yes, within browser memory limits. Files up to several megabytes process instantly. Very large JSON files (10MB+) may take a second or two to format due to browser rendering limits for large text areas. For files larger than ~50MB, a CLI tool like jq is more suitable.

Related tools