JSON to JSDoc Typedef
JSON → JSDoc @typedef blocks, emitted leaf-first so each typedef is defined before it is referenced. Works with tsc --checkJs and editor IntelliSense.
JSON to JSDoc Typedef — Free Online Tool
Generates JSDoc @typedef blocks from a JSON sample so plain JavaScript files get editor autocomplete and tsc --checkJs type safety without migrating to TypeScript, inferring number, string, boolean, array and nested object typedefs, quoting keys that are not valid identifiers, and marking null-valued properties as nullable.
How to use the JSON to JSDoc Typedef
- Open the tool above — it runs entirely in your browser, so your input never leaves this page.
- Paste or type your input into the field, then press the relevant button (e.g. Encode / Decode, Generate, or Convert).
- Copy the result from the output area with the copy button orCtrl/Cmd + C.
- No signup, no upload, and no tracking — repeat as often as you need.
Frequently asked questions
Why use JSDoc instead of migrating to TypeScript?
JSDoc typedefs give you the same editor autocomplete and tsc --checkJs error checking without a build step, a tsconfig migration or renaming files. It is the pragmatic option for an existing JavaScript codebase or a small script.
How are nullable properties marked?
A property whose sample value is null is emitted as {?*} — nullable, unknown type. Replace the asterisk with the real type (for example {?string}) once you know what the field holds when it is present.
Does the order of the typedefs matter?
For tsc it does not, but some editors resolve a @typedef only after it has been seen. Nested typedefs are emitted before the typedef that references them so both behaviours work.
Free & private — why use this JSON to JSDoc Typedef
The JSON to JSDoc Typedef runs 100% client-side in your browser. Your data is never uploaded to a server, no account is required, and the tool is completely free. It works offline once the page has loaded and is part of a growing collection of privacy-first developer utilities.