```yaml
product: AlterLab
title: "Structured Output — Web Scraping Glossary | AlterLab"
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
source_url: https://alterlab.io/glossary/structured-output
```

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?).

### What is 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.

### How does AlterLab handle Structured Output?

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

[Structured Data ExtractionConverting free-form HTML into typed JSON records using explicit schemas, producing clean structured output instead of raw markup.](https://alterlab.io/glossary/structured-data-extraction)[JSONJavaScript Object Notation — the universal text format for structured data exchange between APIs and web services.](https://alterlab.io/glossary/json)[Schema ValidationSchema validation checks that extracted data conforms to an expected structure and type constraints before it is written to a database or downstream system.](https://alterlab.io/glossary/schema-validation)[Data PipelineA data pipeline is an automated sequence of steps that ingests raw data from a source, transforms it, and delivers it to a destination such as a database, data warehouse, or analytics system.](https://alterlab.io/glossary/data-pipeline)[Scraping APIA managed web scraping service that abstracts proxy rotation, JavaScript rendering, and automatic website compatibility into a single HTTP endpoint.](https://alterlab.io/glossary/scraping-api)

## 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](https://alterlab.io/docs/api/rest)

[Back to Glossary](https://alterlab.io/glossary)