JSON to Zod, Pydantic, TypeScript and LLM tool schemas
Paste a payload, read its pinout, copy the package you need. Runs in this tab; nothing is uploaded.
Paste a payload
JSONJSON5Python dictNDJSON
Inferred part
4 parts · 25 pins
- Required
- Optional
- Nullable
| Pin | Name | Type | Mode | Sample |
|---|---|---|---|---|
| 1 | booking_id | string | Required | bk_9f4c3a12-8e1b-4f72-9852-c62d08a5f331 |
| 2 | pnr | string | Required | NOR742 |
| 3 | status | string | Required | CONFIRMED |
| 4 | created_at | datetime | Required | 2026-08-21T15:30:00Z |
| 5 | passengers | U2[] | Required | — |
| 6 | itinerary | U3 | Required | — |
| 7 | payment | U4 | Required | — |
Generated schema
FlightBookingRequest.openai.json
One payload, eleven packages
Converters usually emit one target, and schema builders make you type each field by hand. SchemaCraft infers the model once and writes it for every place it has to go: the LLM provider, your Python service and your TypeScript client.
LLM tools
- OPENAI-STRICTOpenAI structured output: response_format for the Chat Completions and Responses APIsA response_format block with type json_schema and strict: true.JSON to OpenAI structured output →
- ANTHROPIC-TOOLAnthropic tool schema: a tool definition with input_schema for Claude tool useA tool with a snake_case name, a description and input_schema.JSON to Anthropic tool schema →
- GEMINI-FNGemini function declaration: a function declaration for Gemini function callingA declaration with name, description and parameters.JSON to Gemini function declaration →
- MCP-TOOLMCP tool schema: a Model Context Protocol tool with inputSchemaA tool with name, description and inputSchema.JSON to MCP tool schema →
- JSONSCHEMA-2020JSON Schema: a plain JSON Schema draft 2020-12 document$schema set to draft 2020-12, with a title from the root model name.JSON to JSON Schema →
TypeScript
- ZOD-V3Zod schema: runtime validation plus z.infer typesOne z.object per model with a matching z.infer type.JSON to Zod schema →
- TS-TYPESTypeScript types: interfaces or type aliases with no runtime costOne interface (or type alias) per model.JSON to TypeScript types →
- VALIBOT-V1Valibot schema: a tree-shakable validator with InferOutput typesv.object per model with v.pipe validators for email, url, uuid and dates.JSON to Valibot schema →
Systems
- RUST-SERDERust serde structs: structs deriving Serialize and DeserializeOne struct per model deriving Debug, Clone, PartialEq, Serialize, Deserialize.JSON to Rust serde structs →
- GO-STRUCTGo structs: structs with json tags for encoding/jsonExported PascalCase fields with json tags that keep the original keys.JSON to Go structs →
What the inference reads from your samples
Every rule shows up on the pinout before you copy anything, and each one can be switched off under Inference rules. IDs and names stay strings: a value only becomes an enum when it looks like a label and repeats.
| Detected | When | Sample | Zod | Pydantic |
|---|---|---|---|---|
| UUID | 8-4-4-4-12 hex | 550e8400-e29b-41d4-… | z.string().uuid() | UUID |
| local@domain.tld | ada@example.com | z.string().email() | EmailStr | |
| URL | http or https | https://pay.example/r/891 | z.string().url() | HttpUrl |
| Date-time | ISO 8601 with time | 2026-08-21T15:30:00Z | z.string().datetime() | datetime |
| Date | ISO 8601 date | 2026-08-21 | z.string().date() | date |
| IP address | IPv4 or IPv6 | 10.0.0.1 | z.string().ip() | IPvAnyAddress |
| Enum | repeated short labels | GOLD, PLATINUM | z.enum(["GOLD", …]) | Literal["GOLD", …] |
| Integer | whole numbers only | 645 | z.number().int() | int |
| Optional | key missing in a sample | { } vs { "x": 1 } | .optional() | X | None = None |
| Nullable | key present as null | "special_meal": null | .nullable() | X | None |
Against the usual ways to get a schema
| Capability | SchemaCraft | Single-target converters | Manual schema builders | Asking an LLM to write it |
|---|---|---|---|---|
| Takes JSON5, Python dicts and NDJSON | Yes | Usually JSON only | No input | Yes |
| Many outputs from one paste | 11 packages | One | One or a few | One per prompt |
| Provider strict rules applied | Yes, on every object | Rarely | By hand | Often missed |
| Shows what it inferred | Pinout and pin table | No | You define it | No |
| Same output every time | Yes | Yes | Yes | No |
| Check a payload against it | Test bench | Varies | Varies | No |
| Payload stays on your machine | Yes | Varies | Varies | No, it is sent to the model |
Categories, not named products: tools in each group vary.
Questions
Is my payload uploaded anywhere?
No. Parsing, inference and every generator run in a Web Worker inside your browser tab. The page makes no request with your data, so it is safe for internal payloads.
What input does SchemaCraft accept?
Standard JSON, JSON5 (comments, trailing commas, single quotes, unquoted keys), Python dict literals with True, False and None, and NDJSON with one record per line. Many records are merged into one model.
Why does OpenAI strict mode need every field in required?
Structured Outputs with strict: true only accepts schemas where every object lists all of its properties in required and sets additionalProperties: false. A field that can be absent is written as a union with null instead. The OPENAI-STRICT package applies those rules for you, on every nested object.
What is the difference between optional and nullable?
Optional means a key was missing from at least one sample. Nullable means the key was present with the value null. SchemaCraft keeps them apart: Zod gets .optional() or .nullable(), TypeScript gets ? or | null, and the pin table shows which is which.
When does a string become an enum?
Only when the values look like labels (GOLD, in_transit) and repeat across samples, up to the limit you set in Inference rules. IDs, names and free text stay strings. You can turn enum detection off.
Which string formats are detected?
UUIDs, emails, URLs, ISO 8601 date-times and dates, and IPv4 and IPv6 addresses. Each package writes them its own way: z.string().email() in Zod, EmailStr in Pydantic, format: email in JSON Schema, and a description in OpenAI strict, which rejects format.
Can I check a payload against the generated schema?
Yes. The Test bench validates any payload you paste against the inferred schema and lists each missing field, wrong type and unexpected key with its path. Mock data gives you a valid sample to start from.
Does it emit Pydantic v1 as well as v2?
Yes. v2 uses model_config = ConfigDict(extra="forbid") under strict mode; v1 uses a nested Config class. You can also pick X | None or Optional[X].
Do I need an account?
No. Pasting, every package, copying, downloading, the test bench and mock data are free without an account. Only the ZIP export of all packages at once asks you to sign in.
Made by Nor AI
SchemaCraft is a free tool from Nor AI Technologies, an engineering studio in Ghazipur, Uttar Pradesh. We build custom AI, web and 3D software that runs in your own infrastructure, and you keep the code.
Wiring structured output or tool calling into your product, or need a typed data layer around an LLM pipeline? You talk to the engineers who write the code.