Pydantic
Python data validation library that uses type hints to define and enforce schemas.
Liked for validating LLM structured output, catching malformed JSON for retries with helpful error messages,123 and for typed data models and DTOs in larger Python codebases.45 It suits Python developers who validate LLM output, scraped data, or JSON passed between services,67 though one commenter was still waiting for first-class support in the Ty type checker.8
Why people recommend it
LLM output validation · 3
Strict schemas catch malformed JSON from LLMs and give clear errors to retry with.
“We wrap tool calls in strict Pydantic schemas to catch and retry malformed JSON”
“you can add complex pydantic validators (or whatever, I use pydantic) with super helpful error messages”
Show 1 more
“an explicit enough_context flag via Instructor + Pydantic”
Typed data models · 2
Used as DTOs and typed models to bring type safety to larger Python projects.
“push all ORM work into repositories that return Pydantic DTOs”
“We use Pydantic heavily”
API design · 2
Credited with influential API design and with advancing the Python ecosystem.
“the hard work that the original designers of libraries like FastAPI, Zod, Pydantic, have invested”
“I see Astral and Pydantic as a league of their own in terms of advancing Python”
Data validation · 2
Validates JSON before it reaches the database and fits well with JSON Schema across stacks.
“JSON goes through Pydantic validation before it touches the database.”
“the support for JSON Schema is much better across the stacks I use, e.g. Zod in JS/TS, Pydantic in Python”
Fast iteration · 1
Changing validators is a quick edit and rerun, with no compile step.
“With Python or JS, this is a pydantic edit + run.”
Readability · 1
Seen as more restrained and readable than Zod.
“Even Pydantic looks tamed compared to Zod.”
Caveats and dissent
Ty support · 1
First-class support in the Ty type checker was still pending at the time.
“We use Pydantic heavily”
Often compared with
Who recommends it in their own words
Threads where it came up
- Zod v4.5 adds schema compilation (3-9x faster validation) 1 mention
- Protobuf has LSP support. You're welcome 1 mention
- Ask HN: Who wants to be hired? (August 2026) 1 mention
- If AI Writes Your Code, Why Use Python? 1 mention
- Show HN: 15 yrs of Django in prod: patterns I keep using (agent skills) 1 mention
- FastAPI-compatible Python framework with Zig HTTP core; 7x faster 1 mention
Also written as pydantic. Data: pydantic.json. Quotes are verbatim; the verdict and theme labels are written by a model from these comments, and every clause links to its sources.
All comments 11
“Even Pydantic looks tamed compared to Zod.”
“the support for JSON Schema is much better across the stacks I use, e.g. Zod in JS/TS, Pydantic in Python”
“an explicit enough_context flag via Instructor + Pydantic”
“With Python or JS, this is a pydantic edit + run.”
“push all ORM work into repositories that return Pydantic DTOs”
“the hard work that the original designers of libraries like FastAPI, Zod, Pydantic, have invested”
“JSON goes through Pydantic validation before it touches the database.”
“We use Pydantic heavily”
“We wrap tool calls in strict Pydantic schemas to catch and retry malformed JSON”
“I see Astral and Pydantic as a league of their own in terms of advancing Python”
“you can add complex pydantic validators (or whatever, I use pydantic) with super helpful error messages”