extraction

Structured Output

Structured output is data extracted from web pages and returned in a machine-readable format such as JSON or CSV, with well-defined fields rather than raw HTML text.

Raw HTML is designed for browser rendering, not data consumption. Structured output transforms page content into formats suited to downstream processing: JSON objects with named fields, CSV rows aligned to a schema, or database records. The transformation requires identifying the relevant HTML elements, extracting their text or attribute values, and mapping them to the target schema's field names and types.

AlterLab's extraction parameter accepts a field-to-selector mapping, allowing callers to specify exactly which data to extract and receive a clean JSON object in response, bypassing HTML entirely. This structured approach decouples the caller from the target site's HTML structure: when the site changes its CSS classes, only the selector mapping in the API call needs updating.

Structured output is the primary deliverable of a scraping API. The quality of structured output is measured by extraction accuracy (did the correct values come back?), completeness (were all expected fields populated?), and schema stability (does the output format stay consistent as target sites change?).

Examples

# AlterLab extraction with structured output
curl -X POST https://api.alterlab.io/v1/scrape \
  -H "X-API-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/product/1",
       "extract": {"name": "h1.product-title",
                   "price": "span.price",
                   "in_stock": ".stock-status"}}'
# Returns: {"data": {"name": "Widget", "price": "$49.99", "in_stock": "In Stock"}}

Related Terms

Extract Structured Output data from any website

AlterLab returns clean, structured data from any public URL — no scraper infrastructure needed. Start free, no credit card required.

View API docs

Your first scrape.
Sixty seconds.

$1 free balance. No credit card. No SDK.Just a POST request.

terminal
curl -X POST https://api.alterlab.io/v1/scrape \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "formats": ["markdown"]}'

No credit card required · Up to 5,000 free scrapes · Balance never expires

    Structured Output — Web Scraping Glossary | AlterLab