/Knowledge/sources/honojs__hono/llms-full/validation-zod-validator-middleware--fd8800b22d16.md
Validation: Zod Validator Middleware - hono-docs
Validation: Zod Validator Middleware Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt zod validator mid...
Validation: Zod Validator Middleware
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#zod-validator-middleware
Summary
You can use the Zod Validator Middleware to make it even easier. ::: code-group sh [npm] npm i @hono/zod-validator ```sh [yarn] yarn add @hono/zod-validator...
Content
You can use the Zod Validator Middleware to make it even easier.
::: code-group
npm i @hono/zod-validator
yarn add @hono/zod-validator
pnpm add @hono/zod-validator
bun add @hono/zod-validator
:::
And import zValidator.
import { zValidator } from '@hono/zod-validator'
And write as follows.
const route = app.post(
'/posts',
zValidator(
'form',
z.object({
body: z.string(),
})
),
(c) => {
const validated = c.req.valid('form')
// ... use your validated data
}
)
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#zod-validator-middleware",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / Validation > Zod Validator Middleware",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 104,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "Validation: Zod Validator Middleware",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}