SchemaCraftby

JSON to Valibot schema converter

Paste JSON, JSON5, a Python dict or NDJSON and get a tree-shakable validator with InferOutput types. The model is inferred from your samples, drawn as a pinout so you can check it, and written out ready to copy. Nothing leaves your browser.

Open the workbench with VALIBOT-V1

What you get

  • v.object per model with v.pipe validators for email, url, uuid and dates.
  • v.picklist for enums, v.nullable and v.optional kept apart.
  • An InferOutput type for each schema.

Example: a flight booking payload

The sample below has nested passengers, an itinerary and a payment. This is the Valibot schema SchemaCraft writes for it, with strict mode on.

booking.json · input

{
"booking_id": "bk_9f4c3a12-8e1b-4f72-9852-c62d08a5f331",
"pnr": "NOR742",
"status": "CONFIRMED",
"created_at": "2026-08-21T15:30:00Z",
"passengers": [
{
"passenger_id": "pax_01",
"first_name": "Sarah",
"last_name": "Connor",
"email": "sarah.connor@skyline.org",
"loyalty_tier": "PLATINUM",
"checked_bags": 2,
"special_meal": "VEGAN"
},
{
"passenger_id": "pax_02",
"first_name": "John",
"last_name": "Connor",
"email": "john.connor@skyline.org",
"loyalty_tier": "GOLD",
"checked_bags": 1,
"special_meal": null
}
],
"itinerary": {
"flight_number": "NA-204",
"origin": "SFO",
"destination": "HND",
"departure_time": "2026-09-15T11:45:00Z",
"arrival_time": "2026-09-16T15:30:00Z",
"duration_minutes": 645,
"cabin_class": "BUSINESS"
},
"payment": {
"amount": 3420.5,
"currency": "USD",
"is_settled": true,
"receipt_url": "https://pay.norai.dev/receipts/rec_891274"
}
}

FlightBookingRequest.ts · VALIBOT-V1

import * as v from "valibot";
export const FlightBookingRequestPassengersItemSchema = v.object({
passenger_id: v.string(),
first_name: v.string(),
last_name: v.string(),
email: v.pipe(v.string(), v.email()),
loyalty_tier: v.picklist(["PLATINUM", "GOLD"]),
checked_bags: v.pipe(v.number(), v.integer()),
special_meal: v.nullable(v.string()),
});
export type FlightBookingRequestPassengersItem = v.InferOutput<typeof FlightBookingRequestPassengersItemSchema>;
export const FlightBookingRequestItinerarySchema = v.object({
flight_number: v.string(),
origin: v.string(),
destination: v.string(),
departure_time: v.pipe(v.string(), v.isoTimestamp()),
arrival_time: v.pipe(v.string(), v.isoTimestamp()),
duration_minutes: v.pipe(v.number(), v.integer()),
cabin_class: v.string(),
});
export type FlightBookingRequestItinerary = v.InferOutput<typeof FlightBookingRequestItinerarySchema>;
export const FlightBookingRequestPaymentSchema = v.object({
amount: v.number(),
currency: v.string(),
is_settled: v.boolean(),
receipt_url: v.pipe(v.string(), v.url()),
});
export type FlightBookingRequestPayment = v.InferOutput<typeof FlightBookingRequestPaymentSchema>;
export const FlightBookingRequestSchema = v.object({
booking_id: v.string(),
pnr: v.string(),
status: v.string(),
created_at: v.pipe(v.string(), v.isoTimestamp()),
passengers: v.array(FlightBookingRequestPassengersItemSchema),
itinerary: FlightBookingRequestItinerarySchema,
payment: FlightBookingRequestPaymentSchema,
});
export type FlightBookingRequest = v.InferOutput<typeof FlightBookingRequestSchema>;

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.