@tpmjs/tools-extract-json-ld
Extract JSON-LD structured data from web pages
Module not found "https://esm.sh/node:sqlite?target=denonext".
at [0m[36mhttps://esm.sh/undici@7.16.0?target=denonext[0m:[0m[33m2[0m:[0m[33m8[0mLast checked: 1/1/2026, 1:05:19 AM
Test @tpmjs/tools-extract-json-ld (extractJsonLdTool) with AI-powered execution
0/2000 characters
Install this tool and use it with the AI SDK
npm install @tpmjs/tools-extract-json-ldpnpm add @tpmjs/tools-extract-json-ldyarn add @tpmjs/tools-extract-json-ldbun add @tpmjs/tools-extract-json-lddeno add npm:@tpmjs/tools-extract-json-ldimport { extractJsonLdTool } from '@tpmjs/tools-extract-json-ld';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { extractJsonLdTool } from '@tpmjs/tools-extract-json-ld';
const result = await generateText({
model: openai('gpt-4o'),
tools: { extractJsonLdTool },
prompt: 'Your prompt here...',
});
console.log(result.text);Available configuration options
urlstringThe URL to fetch and extract JSON-LD from
Try to auto-extract schema from the package
Extract JSON-LD structured data from web pages.
npm install @tpmjs/tools-extract-json-ld
import { extractJsonLdTool } from '@tpmjs/tools-extract-json-ld'; const result = await extractJsonLdTool.execute({ url: 'https://example.com' }); console.log(result); // { // url: 'https://example.com', // jsonLd: [{ @type: 'Organization', name: 'Example', ... }], // types: ['Organization'], // count: 1, // metadata: { // fetchedAt: '2025-12-31T12:00:00.000Z', // domain: 'example.com' // } // }
JSON-LD (JavaScript Object Notation for Linked Data) is a structured data format used by websites to provide machine-readable metadata about their content. It's commonly used for:
<script type="application/ld+json"> tags from a web page@type schema types found in the data{ url: string; // The URL to fetch and extract JSON-LD from }
{ url: string; // The fetched URL jsonLd: Array<Record<string, unknown>>; // Array of JSON-LD objects types: string[]; // Array of detected @type values count: number; // Number of JSON-LD objects found metadata: { fetchedAt: string; // ISO timestamp of fetch domain: string; // Domain name extracted from URL }; }
The tool automatically extracts @type values, which typically include:
const result = await extractJsonLdTool.execute({ url: 'https://store.example.com/product/widget' }); console.log(result.types); // ['Product', 'BreadcrumbList', 'Organization'] const productData = result.jsonLd.find(item => item['@type'] === 'Product'); console.log(productData); // { // @type: 'Product', // name: 'Amazing Widget', // price: '29.99', // availability: 'InStock', // ... // }
The tool provides detailed error messages for common issues:
All errors include specific details to help diagnose the problem.
fetch API)@tpmjs/tools-page-brief - Extract main content and create summaries@tpmjs/tools-links-catalog - Extract and categorize all links@tpmjs/tools-table-extract - Extract HTML tables as structured dataMIT
Downloads/month
0
Quality Score