JSON Formatter
Format, minify, validate JSON and generate TypeScript types. Everything stays in your browser.
Format, minify and validate JSON, and turn a sample payload into TypeScript interfaces — all inside the tab, so an API response containing tokens or customer data never reaches a server.
What each button does
Format re-indents with two spaces so deeply nested objects become readable. Minify strips every optional space and newline, which is what you want before embedding JSON in a query string or shipping a config file. Validate reports the position of the first syntax error rather than a generic failure, which is usually the difference between a two-second fix and ten minutes of squinting.
Generate Types walks the parsed value and emits TypeScript interfaces. Nested objects become named types, arrays become element types, and primitives map to string, number, boolean and null. It infers from a single sample, so it cannot know which fields are optional or which values form a union. Treat the output as a starting point, not a schema.
Why this runs in your browser
Most online formatters post your input to a server, format it, and send it back. That is fine for a tutorial snippet and a bad idea for a live API response, which routinely carries session tokens, email addresses and internal identifiers. There is no reason for that round trip: JSON.parse and JSON.stringify are built into every browser.
Here the work happens in the page. Nothing is uploaded, nothing is logged, and the tool keeps working if your network drops mid-session.
JSON mistakes that break parsers
JSON is stricter than JavaScript object syntax, and the gap catches people constantly. Trailing commas are invalid. Single quotes are invalid. Comments are invalid. The values NaN and Infinity are invalid. Duplicate keys are legal but silently keep the last one, which is a real source of bugs when two systems merge configs.
The subtler one is numeric precision. JSON has no integer type, so every number is a double. Integers above 2^53 lose precision, which is why large database IDs and Discord snowflakes are usually transmitted as strings. If your ID looks wrong after a round trip, that is the cause.
Frequently asked questions
- Does it handle large payloads?
- It handles anything your browser can hold in memory, typically tens of megabytes. Parsing happens on the main thread, so a multi-megabyte file will briefly freeze the tab while it formats.
- Can it fix invalid JSON automatically?
- No, and you should be suspicious of tools that claim to. Guessing where a missing brace belongs can silently change meaning. It reports the error position so you can fix the actual problem.
- Is my data stored anywhere?
- No. There is no backend for this tool. Closing the tab discards everything.