JSON Formatter, Validator and Minifier
Format, validate and minify JSON in your browser. Errors point to the exact line and column, and keys can be sorted. Nothing is uploaded.
Runs in your browser. Nothing is uploaded.
Example
Input:
{"name":"Asif","skills":["angular","node"],}Result:
Invalid JSON at line 1, column 44: trailing comma before }
Format, minify, validate
Paste JSON and the tool parses it with the browser's JSON.parse, the same parser your JavaScript code uses, so "valid here" means valid in your app. Valid input is pretty-printed with 2 or 4 spaces or a tab, or minified to one line for payloads and environment variables. You can sort object keys alphabetically to make two documents easy to diff.
When the input is invalid, the error is translated into a line and column with the offending line shown, which is much faster than counting characters in a 2,000-line API response.
The errors you will meet most
Trailing commas after the last item, single quotes instead of double quotes, unquoted keys, comments, and NaN or undefined values are all valid in JavaScript object literals but invalid in JSON. Copying an object from code or a config file is the usual way they sneak in. Another frequent one is a BOM or invisible character at the start of a file saved by a Windows editor; the tool reports it at line 1, column 1.
Large integers are a quieter problem: JSON allows any number, but JavaScript stores numbers as 64-bit floats, so ids above 9,007,199,254,740,991 lose precision when parsed. If an API returns big ids, ask for them as strings.
From valid JSON to types
Once the JSON is valid, you can turn it into TypeScript interfaces or a Mongoose schema with the related tools below, which reuse the same parsing. For APIs you own, validate request bodies at runtime as well, because a document that is valid JSON can still have the wrong shape.
Minified JSON is what you want on the wire, and gzip or Brotli compression removes most of the remaining overhead anyway, so pretty-printing only matters for humans. In Express, express.json() rejects bodies over 100 kB by default with a 413 error; raise the limit option deliberately for endpoints that really receive large documents instead of globally. Sorting keys before saving fixtures and snapshots keeps your diffs in code review small and readable.
Frequently asked questions
Why is my JSON invalid when it works in JavaScript?
JSON is stricter: double quotes only, no trailing commas, no comments, no undefined or NaN.
Can it handle large files?
Files of several megabytes work in modern browsers. Very large documents may make the page slow because everything runs locally.
Is my JSON sent to a server?
No. Parsing and formatting happen in your browser.
