Tool Forge
Free
Client-Side
JSON to TypeScript, Pydantic, Zod & JSON Schema
Paste a sample JSON payload — a tool-call arguments object, an LLM structured output, or an API response — and get typed definitions in four targets at once. Everything runs in your browser.
JSON Input
Presets
Generated from your example. A single example only shows the keys it contains — see the notes below.
How JSON values map to types
| JSON value | TypeScript | Pydantic v2 | Zod | JSON Schema |
|---|---|---|---|---|
| "text" | string | str | z.string() | "string" |
| 42 | number | int | z.number().int() | "integer" |
| 3.14 | number | float | z.number() | "number" |
| true | boolean | bool | z.boolean() | "boolean" |
| null | null | None | z.null() | "null" |
| [ … ] | T[] | List[T] | z.array(T) | "array" |
| { … } | interface | BaseModel | z.object() | "object" |
| missing key | key?: | Optional[T] = None | .optional() | not in required |
Frequently Asked Questions
Does this upload my JSON anywhere?
No. All parsing and code generation runs in your browser with vanilla JavaScript. The JSON you paste never leaves the page and is never sent to a server — safe for payloads that contain real data.
How does it handle arrays where objects have different keys?
It merges every element into one shape. A key present in some elements but not others becomes
optional, and a key whose value type differs across elements becomes a union. That makes a multi-element array a better schema source than a single object.
Why generate Pydantic and Zod for LLM outputs?
When a model returns structured output or tool-call arguments, you get JSON you have to validate before trusting it. A Pydantic model (Python) or Zod schema (TypeScript) turns your example into a runtime validator, so a malformed model response fails loudly at the boundary instead of corrupting logic three calls deeper.
Can one example miss fields?
Yes. Inference from a single example only sees the keys in that example. If a field is sometimes absent or nullable, paste an array of several representative objects so the merge marks those keys optional — or hand-edit the generated types. This tool gets you 90% of the way, not a substitute for a real spec.