AZ Tools

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.

JSDoc typedefs

How to use

  1. Paste or type your JSON into the input box.
  2. Optionally rename the root typedef (defaults to Root).
  3. 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