JSON Formatter & Validator

Format, minify, validate & explore JSON β€” instantly, in your browser

πŸ“‚ Content restored from your last session.
Paste valid JSON in the editor to see the tree view here.
0 chars 0 lines
πŸ”’ Privacy: All formatting and validation runs entirely in your browser. Your JSON is never sent to any server.

JSON Syntax Quick Reference

TypeExampleNotes
Object{"key": "value"}Keys must be double-quoted strings
Array[1, "two", true]Ordered list of values
String"hello\nworld"Double-quoted; escape with \
Number42, 3.14, -1e5No leading zeros; no NaN/Infinity
Booleantrue / falseLowercase only
NullnullLowercase only

Common JSON Errors

Error messageLikely causeFix
Unexpected token ','Trailing comma after last elementRemove the trailing comma
Unexpected token 'u'undefined used as a valueReplace with null
Unexpected token '/'Comment in JSON (// or /* */)Remove comments β€” JSON doesn't support them
Unexpected token '''Single-quoted stringUse double quotes
Unexpected end of JSONUnclosed bracket or braceCheck bracket/brace balance

FAQ

What is valid JSON?

Valid JSON must have a single root value (object, array, string, number, boolean, or null), strings in double quotes, no trailing commas, and no comments. Keys in objects must also be double-quoted strings.

How does the error line and column detection work?

The tool parses the JSON.parse error message to extract a character position, then counts newlines in the input up to that position to compute the exact line and column number. The error line is highlighted in the editor.

Is my JSON data sent to a server?

No. All formatting, validation, and tree rendering happens entirely in your browser using JavaScript. Your JSON never leaves your device.

Can I open a .json file?

Yes. Click the 'Open File' button and select a .json or .txt file. The contents are read using the FileReader API in your browser β€” no upload occurs.

What does the tree view show?

The tree view renders your JSON as an expandable/collapsible hierarchy. Each node shows its type with color-coded badges. You can search keys and values and copy individual node values.