# Structured Data Extractor – JSON-LD, Microdata & RDFa (`adamplaenitz/structured-data-extractor`) Actor

Extract schema.org structured data from any list of URLs: JSON-LD (incl. @graph), Microdata and RDFa. Get the found types, the raw objects and validation warnings for Product, Offer, Organization, LocalBusiness, Article, Breadcrumb, FAQ, Event, Recipe and more.

- **URL**: https://apify.com/adamplaenitz/structured-data-extractor.md
- **Developed by:** [Adam Plänitz](https://apify.com/adamplaenitz) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 page extracteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Structured Data Extractor – JSON-LD, Microdata & RDFa

**Extract the schema.org structured data of any list of web pages and check it for common mistakes.** The Actor reads JSON-LD (including `@graph` and arrays), Microdata (including nested items and `itemref`) and RDFa Lite, returns the found types and the complete objects as JSON, and flags invalid JSON-LD as well as missing required and recommended properties for the types that matter for rich results – Product, Offer, Organization, LocalBusiness, Article, BreadcrumbList, FAQPage, Event, Recipe, JobPosting, VideoObject, Review and more. Plain HTTP requests, no browser. Export as JSON, CSV or Excel, or connect to Google Sheets, Make, Zapier, n8n or webhooks.

### What does it do?

For every URL the Actor fetches the HTML (redirects are followed) and:

1. **Extracts structured data**
   - **JSON-LD:** every `<script type="application/ld+json">` block; arrays and `@graph` are unfolded into separate entities and inherit the `@context`. Blocks that are **not valid JSON** are reported as errors (search engines ignore them). If the breakage is a common one – trailing commas, raw line breaks in strings, JavaScript comments, several objects in one block, HTML comment / CDATA wrappers – the data is repaired *for display only* so you can see what was intended.
   - **Microdata:** `itemscope` / `itemtype` / `itemprop` following the HTML standard (values from `content`, `href`, `src`, `datetime`, `value`, nested items, `itemref`, `itemid`), converted to the same JSON shape as JSON-LD.
   - **RDFa Lite:** `vocab` / `typeof` / `property` / `resource` for schema.org (also `schema:` prefixes). Other RDFa vocabularies and Open Graph meta tags are not included.
2. **Lists the types:** top-level types per page (`types`) and every type including nested ones (`allTypes`), counts per format.
3. **Validates** (can be switched off):
   - required properties (`error`) and recommended properties (`warning`) for common types, based on the public rich result documentation of search engines – e.g. Product needs `name` and one of `offers` / `review` / `aggregateRating`; BreadcrumbList items need `position`, `name` and `item` (except the last); FAQPage questions need an accepted answer with `text`; Event needs `name`, `startDate` and `location`; LocalBusiness needs `name` and `address`;
   - values: ISO 8601 dates and durations (`PT30M`), numeric prices without currency symbols, 3-letter currency codes, schema.org `availability` and `eventStatus` values, numeric ratings, absolute URLs, missing or non-schema.org `@context`.
   - `@id` references to other nodes count as present. Subtypes are recognised (e.g. `Dentist` → LocalBusiness rules, `BlogPosting` → Article rules).

### Who is it for?

- **SEO specialists and agencies:** audit the structured data of product, recipe, event or article templates in bulk.
- **Developers:** check markup after a deployment or a CMS / plugin update; find broken JSON-LD quickly.
- **Data teams:** collect product, organisation or event data that websites publish in machine-readable form.

### Input

| Field | Default | Description |
|---|---|---|
| URLs | – | Pages to process (one per line). Duplicates are removed. |
| Output | one row per page | Or one row per top-level entity (flat). |
| JSON-LD / Microdata / RDFa | on | Formats to extract. |
| Validate | on | Required / recommended properties and value checks. |
| Include the extracted objects | on | Switch off to get only types, counts and warnings. |
| Only these types | – | e.g. `Product`, `Recipe` – keeps only top-level entities of these types. |
| User-Agent, parallel requests, timeout | – | Advanced settings. |

### Output example (one row per page, shortened)

```json
{
  "url": "https://apify.com/apify/web-scraper",
  "finalUrl": "https://apify.com/apify/web-scraper",
  "statusCode": 200,
  "hasStructuredData": true,
  "types": ["BreadcrumbList", "Organization", "SoftwareApplication"],
  "allTypes": ["AggregateRating", "BreadcrumbList", "ContactPoint", "ImageObject", "ListItem", "Offer", "Organization", "PostalAddress", "SoftwareApplication"],
  "entityCount": 3,
  "formats": { "jsonLd": 3, "microdata": 0, "rdfa": 0 },
  "jsonLdBlocks": 3,
  "invalidJsonLdBlocks": 0,
  "errorCount": 0,
  "warningCount": 1,
  "entities": [
    {
      "entityIndex": 1,
      "format": "json-ld",
      "type": "SoftwareApplication",
      "types": ["SoftwareApplication"],
      "nestedTypes": ["AggregateRating", "Offer"],
      "data": {
        "@context": "https://schema.org",
        "@type": "SoftwareApplication",
        "name": "Web Scraper",
        "applicationCategory": "BrowserApplication",
        "offers": { "@type": "Offer", "price": 0, "priceCurrency": "USD" },
        "aggregateRating": { "@type": "AggregateRating", "ratingValue": 4.7, "reviewCount": 100 }
      },
      "errorCount": 0,
      "warningCount": 1
    }
  ],
  "warnings": [
    { "severity": "warning", "entityIndex": 1, "format": "json-ld", "type": "SoftwareApplication", "path": "SoftwareApplication", "property": "operatingSystem", "code": "missing-recommended", "message": "SoftwareApplication: recommended property \"operatingSystem\" is missing." }
  ],
  "error": null
}
```

In **flat mode** every top-level entity is its own row with `url`, `format`, `type`, `types`, `data`, its own `warnings` and counts. Pages without structured data get one row with `hasStructuredData: false`.

Warning codes: `invalid-json`, `invalid-json-repaired`, `missing-context`, `non-schema-org-context`, `missing-type`, `missing-required`, `missing-recommended`, `invalid-value`, `invalid-date`, `invalid-duration`, `invalid-price`, `invalid-currency`, `relative-url`, `html-truncated`.

### Pricing and speed

See the **Pricing** tab. You pay per processed page – in both output modes, regardless of how many entities a page contains. Pages without structured data are charged too (the check was done). **Rows for URLs that cannot be reached, return an HTTP error (4xx/5xx) or are not HTML are free.** You can set a maximum cost per run – the Actor stops cleanly when it is reached.

One request per page. In a cloud test, a mixed list of 100 URLs (store pages, Wikipedia articles, shops) took about 5 seconds with the default 5 parallel requests. The Actor runs with 1024 MB memory by default (large pages are parsed faster with more CPU).

### Privacy and responsible use

- **No personal data:** `Person` objects are replaced by `{"@type": "Person", "redacted": true, "properties": [...]}` (the property names stay visible so validation results remain understandable), and plain-text names under `author`, `creator`, `editor`, `reviewedBy`, `founder` and similar properties are replaced by `[redacted: personal data]`. Organisations, products, places and events are kept. Free-text fields such as descriptions are passed through as published.
- Only public pages are fetched, like a browser visit. Private, loopback and internal addresses are refused.
- The structured data belongs to the website owners; respect their terms when you reuse it.

Not affiliated with schema.org, Google or any search engine. The validation is a plausibility check based on public documentation – **not** a replacement for the official Rich Results Test, and it does not guarantee rich results.

### Limits

- **No JavaScript rendering:** structured data that is injected by client-side JavaScript (e.g. by a tag manager) is not seen.
- Only schema.org RDFa is extracted; RDFa with other vocabularies is skipped.
- The rules cover common types and properties; types without rules are extracted but only value-checked.
- HTML larger than 5 MB is truncated (reported as `html-truncated`).

Questions or feature requests? Please open an issue in the **Issues** tab.

# Actor input Schema

## `urls` (type: `array`):

Pages to extract structured data from, one per line (e.g. a product, recipe or article page). Bare domains are fetched as https://domain/. Duplicates are removed.

## `outputMode` (type: `string`):

One row per page (with all entities nested), or one row per top-level entity (flat, easier for spreadsheets). Pricing is per page in both modes.

## `extractJsonLd` (type: `boolean`):

Extract <script type="application/ld+json"> blocks (incl. @graph). Invalid JSON is reported and, where possible, repaired for display.

## `extractMicrodata` (type: `boolean`):

Extract itemscope / itemtype / itemprop markup (incl. itemref).

## `extractRdfa` (type: `boolean`):

Extract RDFa Lite markup (vocab / typeof / property). Open Graph meta tags are not included.

## `validate` (type: `boolean`):

Check common types (Product, Offer, Organization, LocalBusiness, Article, BreadcrumbList, FAQPage, Event, Recipe, JobPosting, VideoObject …) for missing required / recommended properties and invalid values (dates, prices, currencies, URLs).

## `includeRawData` (type: `boolean`):

Include the full extracted objects (JSON). Switch off to get only types, counts and warnings.

## `typeFilter` (type: `array`):

Optional. Keep only top-level entities of these schema.org types, e.g. Product, Recipe, BreadcrumbList (case-insensitive). Empty: all types.

## `userAgent` (type: `string`):

Leave empty to identify as 'Mozilla/5.0 (compatible; structured-data-extractor/0.1; Apify Actor; +https://apify.com)'.

## `maxConcurrency` (type: `integer`):

How many pages are fetched at the same time (1–20), at most 3 per host.

## `timeoutSecs` (type: `integer`):

Maximum time for each page download (complete response).

## Actor input object example

```json
{
  "urls": [
    "https://en.wikipedia.org/wiki/Web_scraping",
    "https://apify.com/apify/web-scraper",
    "https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data",
    "https://www.python.org/"
  ],
  "outputMode": "page",
  "extractJsonLd": true,
  "extractMicrodata": true,
  "extractRdfa": true,
  "validate": true,
  "includeRawData": true,
  "maxConcurrency": 5,
  "timeoutSecs": 30
}
```

# Actor output Schema

## `results` (type: `string`):

One item per page (or per entity in flat mode), plus free rows for URLs that could not be loaded.

## `summary` (type: `string`):

Counts of pages, entities, formats, schema.org types, validation errors and warnings.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://en.wikipedia.org/wiki/Web_scraping",
        "https://apify.com/apify/web-scraper",
        "https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data",
        "https://www.python.org/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("adamplaenitz/structured-data-extractor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "urls": [
        "https://en.wikipedia.org/wiki/Web_scraping",
        "https://apify.com/apify/web-scraper",
        "https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data",
        "https://www.python.org/",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("adamplaenitz/structured-data-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://en.wikipedia.org/wiki/Web_scraping",
    "https://apify.com/apify/web-scraper",
    "https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data",
    "https://www.python.org/"
  ]
}' |
apify call adamplaenitz/structured-data-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,adamplaenitz/structured-data-extractor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/tfUc71VQh3b2j8so1/builds/mLo0OwscxgFR2eMQW/openapi.json
