JSON Formatter and Validator
Pretty-print, minify and validate JSON, with the line and column of the first error. Sort keys to make two payloads comparable.
Free · No sign-up · Your inputs stay in your browser
Input
Format and validate JSON
Output
Valid JSON
Top-level object, 213 characters
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
Why JSON fails to parse
Most invalid JSON is valid JavaScript: a trailing comma after the last item, single-quoted strings, unquoted keys or a comment. RFC 8259 allows none of them. The error message names the position of the first character the parser could not accept, which is usually one character after the real mistake.
When to sort keys
JSON objects are unordered, but diff tools are not. Sorting keys before comparing two API responses or two lock files hides differences that do not matter and shows the ones that do.
Large numbers
JavaScript numbers are IEEE 754 doubles, so integers above 253 (9007199254740992) lose precision when parsed. A 64-bit database ID formatted here can come back with different last digits; send such IDs as strings.