# JSON-LD Entity Inventory and Reference Auditor (`danielmichalek/json-ld-structured-data-extractor`) Actor

Supplied HTML and JSON-LD become an entity inventory with source pointers. Review properties and literal ID references in JSON and CSV. Send your documents through the input to inspect the report.

- **URL**: https://apify.com/danielmichalek/json-ld-structured-data-extractor.md
- **Developed by:** [Daniel Michałek](https://apify.com/danielmichalek) (community)
- **Categories:** SEO tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$30.00 / 1,000 complete json-ld inventory reports

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

## JSON-LD Entity Inventory and Reference Auditor

### Overview

Create a traceable inventory of JSON-LD entity candidates, properties and literal ID references from supplied HTML or JSON-LD text. This supports structured-data intake, content migration review and preparation for downstream data pipelines. Every record carries a document ID, block number and JSON Pointer.

Processing is syntactic and deterministic. Context values remain unexpanded data. Literal ID matching is restricted to one document and one block. Semantic expansion, vocabulary validation and search-engine eligibility require a separate processor and review.

### Input example

Provide up to 20 documents with unique id, format, content and optional sourceUrl. The format is html or jsonld. Content is raw text. IDs use 1 to 80 ASCII letters, digits, dots, underscores or hyphens. A declared sourceUrl is an HTTP or HTTPS provenance label.

```json
{
  "documents": [
    {
      "id": "catalog",
      "format": "jsonld",
      "content": "{\"@context\":\"https://schema.org\",\"@graph\":[{\"@id\":\"#product\",\"@type\":\"Product\",\"name\":\"Supplied item\"}]}"
    }
  ],
  "maxItems": 1
}
```

The combined serialized input limit is 2000000 UTF-8 bytes, with 1000000 bytes per document and 500000 bytes per extracted JSON block. HTML script MIME matching accepts case, whitespace, parameters and HTML character references in the type attribute. Script content remains raw text. Invalid JSON blocks retain a block-level finding while later valid blocks can still be inventoried.

### Output

One dataset item contains documents, blocks, entities, properties, references, contexts and findings. JSONLD_INVENTORY stores matching JSON. ENTITIES_CSV exports one row per entity candidate and REPORT provides a readable finding summary. complete means the audit was delivered. allBlocksParsed identifies whether every extracted block had a supported parsed root.

Objects containing an ID, type or ordinary properties become entity candidates. Pure ID references, context definitions, value objects and reverse or nest property maps are handled separately. Each entity key combines document ID, block number and JSON Pointer. Nested arrays and objects are represented by pointer records; context and value-object data are retained once.

A reference reports ONE_LITERAL_MATCH, MULTIPLE_LITERAL_MATCHES or NO_LITERAL_MATCH. Multiple definitions retain their individual source records. Query strings, fragments, empty relative IDs and blank-node labels remain literal. Context aliases, base declarations and vocabulary expansion can affect semantic identity, which remains outside this literal matching stage.

### Numeric and JSON member representation

Numbers use IEEE-754 binary64 through JavaScript JSON parsing. Nonfinite numeric results and unsafe integers produce UNSUPPORTED_NUMERIC_RANGE block findings. Decimal precision follows binary64 conversion. For example, a sufficiently precise decimal can round during parsing. Preserve exact amounts or long identifiers as strings when their lexical precision is required.

Repeated member names inside a JSON object retain their final occurrence through JSON.parse. The report declares JSON_PARSE_LAST_OCCURRENCE. Document and block hashes identify the supplied text, and original INPUT follows the execution storage's retention settings. This inventory preserves provenance for reviewing the original export.

### Pricing and cost control

The local proposal is USD 0.03 per complete jsonld-inventory-report for up to 20 supplied documents. Cloud qualification and active Store pricing remain pending. The comparable competitor median, actual cloud cost, direct willingness to pay and realized margin remain unverified.

Application limits allow one report, zero content requests and a cooperative 45-second budget. The normal entry point uses a 128 MiB old-generation budget and 8 MiB semi-space. Local acceptance additionally measures full-process RSS and applies a process timeout.

### Limits and fair use

A job supports up to 100 JSON blocks, depth 32, 30000 visited values, 2000 entity candidates, 10000 property records and 5000 literal references. The compact serialized report budget is 6000000 bytes. Reference fan-out is checked before copying match lists. Exceeded limits fail before report delivery.

Traversed property names support 128 characters, pointers 2048 characters and ordinary string values 20000 characters. Context and value-object payloads are retained as bounded raw data. A type list supports up to 100 values, and an ID supports 4096 characters. HTML parsing has a 50000-tag budget.

Source URLs with credentials are rejected. Literal entity IDs remain supplied data. Remove secrets and unnecessary personal information before upload. Markdown escapes supplied identifiers and pointers. CSV protects formula prefixes and preserves numeric identifier strings. JSON retains typed values and explicit nulls.

### Reviewing findings

INVALID_JSON calls for a strict JSON export for the identified block. UNSUPPORTED_NUMERIC_RANGE calls for exporting an exact numeric identifier as a string. NO_JSONLD_BLOCKS identifies supplied HTML without a matching data block. UNCLOSED_JSONLD_SCRIPT calls for reviewing the source HTML export. Ambiguous or missing literal matches should be examined alongside the preserved contexts before semantic processing.

### Development and recovery

Use Node 22 or newer with the pinned lock. Cached dependencies can be installed with npm ci --offline --ignore-scripts --omit=dev --no-audit --no-fund. npm test runs parser and delivery regressions. npm start invokes the real Apify SDK.

PREPARED precedes report effects. COMPLETE requires the expected delivery counters and a physical dataset readback. Replay checks full input, runtime, pricing, JSON, CSV, Markdown and the physical report. Changed or uncertain effects require reconciliation. Use one writer per storage directory and fresh storage for a new intentional job.

# Actor input Schema

## `documents` (type: `array`):

Up to20 objects with unique id, format html or jsonld, content text and optional sourceUrl. Total2MB. Source URLs label supplied text.

## `maxItems` (type: `integer`):

One report with bounded entities/properties/references.

## Actor input object example

```json
{
  "documents": [
    {
      "id": "catalog",
      "format": "html",
      "sourceUrl": "https://example.com/catalog",
      "content": "<html><head><script type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@id\":\"#org\",\"@type\":\"Organization\",\"name\":\"Example Studio\",\"makesOffer\":{\"@id\":\"#offer\"}},{\"@id\":\"#offer\",\"@type\":\"Offer\",\"price\":25.5,\"priceCurrency\":\"EUR\"}]}</script></head><body>Supplied demonstration</body></html>"
    }
  ],
  "maxItems": 1
}
```

# Actor output Schema

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

No description

## `csv` (type: `string`):

No description

## `report` (type: `string`):

No description

# 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 = {
    "documents": [
        {
            "id": "catalog",
            "format": "html",
            "sourceUrl": "https://example.com/catalog",
            "content": "<html><head><script type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@id\":\"#org\",\"@type\":\"Organization\",\"name\":\"Example Studio\",\"makesOffer\":{\"@id\":\"#offer\"}},{\"@id\":\"#offer\",\"@type\":\"Offer\",\"price\":25.5,\"priceCurrency\":\"EUR\"}]}</script></head><body>Supplied demonstration</body></html>"
        }
    ],
    "maxItems": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("danielmichalek/json-ld-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 = {
    "documents": [{
            "id": "catalog",
            "format": "html",
            "sourceUrl": "https://example.com/catalog",
            "content": "<html><head><script type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@id\":\"#org\",\"@type\":\"Organization\",\"name\":\"Example Studio\",\"makesOffer\":{\"@id\":\"#offer\"}},{\"@id\":\"#offer\",\"@type\":\"Offer\",\"price\":25.5,\"priceCurrency\":\"EUR\"}]}</script></head><body>Supplied demonstration</body></html>",
        }],
    "maxItems": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("danielmichalek/json-ld-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 '{
  "documents": [
    {
      "id": "catalog",
      "format": "html",
      "sourceUrl": "https://example.com/catalog",
      "content": "<html><head><script type=\\"application/ld+json\\">{\\"@context\\":\\"https://schema.org\\",\\"@graph\\":[{\\"@id\\":\\"#org\\",\\"@type\\":\\"Organization\\",\\"name\\":\\"Example Studio\\",\\"makesOffer\\":{\\"@id\\":\\"#offer\\"}},{\\"@id\\":\\"#offer\\",\\"@type\\":\\"Offer\\",\\"price\\":25.5,\\"priceCurrency\\":\\"EUR\\"}]}</script></head><body>Supplied demonstration</body></html>"
    }
  ],
  "maxItems": 1
}' |
apify call danielmichalek/json-ld-structured-data-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,danielmichalek/json-ld-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/4VuGdFndGHkBBFYlg/builds/6mjAz2BfDEHxTy8HX/openapi.json
