Schema-Driven Data Extraction: Using Zod & JSON Schema to Extract Structured Data from Any URL
Blog post from Context.dev
Schema-driven web data extraction is presented as a contract-first alternative to traditional CSS selector, XPath, and regex-based scraping, which is vulnerable to website DOM changes and requires ongoing maintenance. The approach uses Zod to define strongly typed data requirements and descriptive field prompts, converts those requirements into JSON Schema for a language-independent exchange format, and sends them to web extraction APIs such as Context.dev that handle rendering, crawling, parsing, PDF ingestion, link traversal, and AI-assisted structuring. Zod provides both TypeScript type inference and runtime validation, while modern APIs can crawl multiple relevant pages to combine distributed information such as pricing, features, and integrations into one validated JSON response. The guide emphasizes safeguards against AI hallucinations through fact-checking settings that prevent unsupported values from being inferred, as well as schema validation that verifies returned data. Compared with legacy scraping, this model is intended to be more resilient to HTML refactoring, easier to scale across mixed content types, and better suited for applications including CRM enrichment, vector databases, and autonomous AI agents.
| Trend | Post Mentions | Total Month Mentions | Posts | Companies | MoM |
|---|---|---|---|---|---|
| LLM | 3 | 5,068 | 1,020 | 229 | -34% |
| AI Agents | 1 | 5,780 | 1,243 | 245 | -15% |
| Data Pipeline | 1 | 355 | 137 | 70 | -33% |
| Serverless | 1 | 783 | 217 | 99 | +1% |
Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.