JSON Formatter
Format, validate, and minify JSON, explore it as a foldable tree or a sortable table, filter it by JSONPath, flatten it to a.b[0] keys and back, open a local .json file, repair broken syntax, and generate TypeScript, Zod, Go, Pydantic or Rust types.
Runs entirely in your browser — nothing you paste is uploaded.
JSON cheat sheet
quick reference- JSON.parse(text)
- Parses a JSON string into a value and throws SyntaxError on a trailing comma or single quote.
- JSON.stringify(value, null, 2)
- Pretty-prints with a two-space indent; the third argument can be a string or a number of spaces.
- undefined, function
- Dropped from objects, but they become null inside arrays during serialization.
- Date
- Serialized through toJSON(), so a Date always becomes an ISO 8601 string such as 2026-11-16T05:00:00.000Z.
- "{\"a\":1}"
- An escaped JSON string stored in logs or env vars needs one unescape pass before it can be parsed.
- $.posts[*].slug
- JSONPath for the path filter: $ is the root, .key reads an object key, [0] reads an array index and [*] collects every item.
Frequently asked questions
answered below the toolHow do I fix a trailing comma in JSON?
Press Auto-fix: it removes trailing commas, comments, single quotes and unquoted keys, then re-validates the result before you copy it.
What is the difference between the TypeScript and Zod output?
TypeScript gives interfaces for typing a variable, while Zod gives a runtime schema that also validates the data it parses.
Can I turn JSON into Go, Python or Rust types?
Yes. Besides TypeScript and Zod, the output menu writes a Go struct, a Pydantic model or a Serde struct with the right field tags and optional fields.
Related TypeScript syntax guides
All TypeScript guidesTS1294: This syntax is not allowed when erasableSyntaxOnly is enabled
Enums, namespaces and parameter properties emit code, so erasable mode rejects them. Convert each to an erasable form without changing call sites.
TypeScriptTS2742: the inferred type cannot be named without a reference
Type checking passes and only declaration emit fails. Annotate the exported boundary so consumers can resolve the emitted type.
TypeScriptESLint 9: the flat config error and why .eslintrc stopped loading
Flat config is one array, one root file, and no string extends. Here is the conversion, the four settings with no equivalent, and the editor trap.
TypeScriptTypeScript 7 native tsc: moduleResolution, baseUrl and API errors
The native compiler changes three defaults and drops the compiler API. Fix tsconfig first, then alias TypeScript 6 for eslint and ts-node.