Skip to main content

Overview

ManyPi uses JSON Schema to ensure your scraped data is always structured, validated, and type-safe. Define your schema once, and get guaranteed data consistency across all scrapes.
Benefits:
  • Catch data issues early with validation
  • Generate TypeScript types automatically
  • Ensure consistent data structure
  • Document your API responses

JSON Schema basics

Every ManyPi scraper uses a JSON Schema to define the structure of extracted data.

Simple example

This schema guarantees:
  • title is always a string
  • price is always a number
  • inStock is always a boolean
  • title and price are always present
  • inStock is optional (not in required array)

Supported data types

Primitive types

Examples: Product names, descriptions, URLs, categories

Complex types

Examples:
Response

TypeScript integration

Generate TypeScript types from your JSON Schema for full type safety in your application.

Using json-schema-to-typescript

1

Install the package

2

Convert schema to TypeScript

generate-types.ts
3

Generated TypeScript types

types/product.ts
4

Use in your application

app.ts

Real-world schemas

E-commerce product

Job listing

Article/Blog post


Validation in practice

Client-side validation

Use libraries like Ajv to validate responses:

Runtime type checking with Zod


Best practices

Not all pages have all data. Use nullable types for optional fields:
When a field has a limited set of possible values, use enums:
Add validation rules to catch data issues:
Add descriptions to help future developers:
Don’t manually write types - generate them from your schema:

Common patterns

Handling optional nested objects

Arrays with minimum items

Conditional requirements


Next steps

Create a scraper

Start building with type-safe schemas

API Reference

See the complete API documentation

Examples

Explore more schema examples

JSON Schema docs

Learn more about JSON Schema