Developer Tools
JSON Formatter and Validator
Format, minify, validate and sort JSON in your browser. Errors show the line, column and cause, and lenient parsing fixes comments and trailing commas.
How to use JSON Formatter and Validator
Paste JSON on the left and choose Format, Minify or Validate; the result updates as you type. Tick Sort keys for a stable key order, or Lenient parsing to turn a JavaScript object with comments or single quotes into standard JSON.
- Paste your JSONPaste an API response, a config file or a log entry. Objects, arrays and single values all work.
- Pick an actionFormat with 2 spaces, 4 spaces or tabs, minify to one line, or validate to see the type, depth and size.
- Copy the resultCopy result copies only the processed JSON. If there is an error, go to the line and column shown.
Error messages that point at the problem
When the JSON does not parse, the tool reports the line and column and says what is wrong, such as a trailing comma after the last item, a key without double quotes or a comment, and marks the spot with a caret under the offending line. The checks are the tool's own, so the message is the same in Chrome, Safari and Firefox. If the only problems are comments, trailing commas, single quotes, bare keys or Python's True, False and None, tick Lenient parsing and the tool fixes them and lists what it changed.
Sorting, duplicate keys and large numbers
Sort keys orders the keys of every object, at every level, while arrays keep their order, so {"b":2,"a":1} minifies to {"a":1,"b":2}. When an object repeats a key, standard parsing keeps only the last value; the tool warns you and gives the line of the first duplicate. Integers longer than 15 digits and long decimals are written out exactly in browsers that support JSON.rawJSON, and older browsers show a warning instead. The default sample is 143 bytes on one line and 214 bytes once formatted.
Accuracy and data handling
Validate the result with your project's own tests and runtime rules before using it in production. The calculation runs in your current browser; the tool code does not send the input to a processing API.
FAQ
Why is my JSON invalid?
The usual causes are a trailing comma, single-quoted strings, keys without double quotes, comments and missing brackets. The tool gives the line, column and reason, and Lenient parsing fixes comments, trailing commas and quotes automatically.
Does formatting change my data?
Only whitespace and indentation change, plus the key order if you sort keys; arrays are never reordered. Repeated keys keep their last value, and newer browsers keep very long integers exactly as written.
Can I minify JSON for a config file or request body?
Yes. Choose Minify to one line to remove every space and line break outside strings, and tick Sort keys as well if you want a stable order for comparing or caching.
Is my JSON uploaded?
No. Parsing, validation, formatting and sorting run in your browser. The input only goes into a URL if you press Share link and copy it.
More Developer Tools
Related toolsExplain a cron schedule in plain English and list its next run times.
Base64, Base64URL and URL percent-encoding in one place, UTF-8 safe.
Bulk-generate random v4 or sortable v7 UUIDs in four formats.
Highlight regex matches, inspect groups and preview replacements live.
Encode or decode URLs and query values with %XX, encodeURI or form rules
Encode special characters as HTML entities or decode entities back to text