JSON to JSDoc @typedef Generator
Developer
Paste any JSON object or array and get ready-to-use JSDoc @typedef definitions, with each field mapped to a JSDoc type (string, number, boolean, type[]) and separate @typedef blocks for nested objects. Perfect for adding types to plain JavaScript without TypeScript. null and empty arrays become the * (any) type. Everything runs locally in your browser — your JSON is never uploaded.
How to use
- Paste or type your JSON into the input box.
- Optionally rename the root typedef (defaults to Root).
- Copy the generated @typedef blocks into your JavaScript source.
Frequently asked questions
- How are types mapped?
- Strings become string, all numbers become number, booleans become boolean, and arrays become type[] based on their first element. Nested objects each get their own @typedef and are referenced by name.
- What about null or empty arrays?
- Their type can't be inferred from the sample, so null maps to * (any) and an empty array maps to *[]. Tighten these by hand if you know the real type.
- Why JSDoc instead of TypeScript?
- JSDoc @typedef lets you document and type-check plain JavaScript (for example with VS Code or tsc --checkJs) without adding a build step or .ts files.
- Is my JSON sent anywhere?
- No. Conversion happens entirely in your browser; nothing is uploaded.
Related tools
Base64 to Hex Converter (and back)
Convert a Base64 string to hexadecimal bytes and hex back to Base64, with URL-safe support, in your browser.
Quoted-Printable Encoder & Decoder
Encode text to MIME Quoted-Printable (RFC 2045) or decode it back — handling =XX escapes, soft line breaks, and UTF-8 — entirely in your browser, with 76-character line wrapping on encode.
Hash Generator (SHA)
Generate SHA-1, SHA-256, SHA-384, and SHA-512 hashes from text.
URL Encoder / Decoder
Percent-encode text for URLs, or decode encoded URLs back to text.
Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to text, instantly.
JSON Formatter & Validator
Format, beautify, minify, and validate JSON right in your browser.