JSON Formatter
Format, minify and validate JSON without changing large integers, number notation, key order or string escapes. Import files and locate syntax errors.
Infer TypeScript types from JSON samples, including nested objects, optional properties, arrays, unions and null.
Updates as you type or change an option
Use representative response samples to draft a type for your application, then review it against the actual API contract.
Paste a representative JSON sample and choose a type name. Copy the generated export or download a .ts file. Array samples are combined: properties missing from some objects become optional and different value types form unions.
Empty arrays use unknown[] and empty objects use { [key: string]: unknown }. A sample cannot describe values it does not contain, so review the type against your API contract. Duplicate keys are rejected. Limits: 2 MiB, 30,000 values and 80 nested levels.
No. Types reflect only the supplied values. Missing properties across array samples become optional, and empty arrays become unknown[]. Runtime validation is not generated.
The generator labels JSON numeric values as number; it does not change how JavaScript parses them. Integers beyond JavaScript’s safe range can lose precision in your application. Use a string-based API representation or a parser that preserves large numbers, and review the generated type accordingly.
Your choice about analytics
We use Umami to measure page visits. Analytics is optional, and your tools work either way.
Your current setting allows analytics.
Your current setting does not allow analytics.
The analytics service has changed. Refresh the page after finishing your current work to apply the new settings.
Your browser is sending a Do Not Track or Global Privacy Control signal. Analytics will remain off.
We use Umami to understand which pages people visit and how they find this site. You can decline or change your choice at any time. All site features will still work.
Your choice is saved in this browser for six months. Analytics does not upload files or content you enter in our tools.
Privacy Policy
Comments
0