browser_extract_json
POST /api/execute/browser_extract_jsonParses unstructured or semi-structured web documents into normalized JSON records using predefined templates or heuristic DOM mining. When a known template (such as `amazon_product`, `google_search`, or `github_repo`) is specified or auto-detected from the URL, dedicated selectors extract canonical fields with high precision. On unfamiliar websites, the engine analyzes repeating sibling subtrees inside the optional container query to identify product cards, feed posts, or directory rows. It automatically maps titles, hyperlinks, thumbnails, prices, ratings, timestamps, and summaries into uniform objects. The returned payload also bundles any embedded Schema.org `application/ld+json` blocks and OpenGraph meta tags found in the document head. Combining heuristic subtree clustering with metadata harvesting yields reliable structured output across arbitrary domains without requiring custom scraper rules or manual XPath maintenance.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| context_id | string | yes | Session identifier whose loaded document will be parsed into structured JSON records. |
| template | string | no | Optional predefined parser name (like 'amazon_product' or 'wikipedia') or empty for auto-detection. |
| selector | string | no | Optional CSS container query restricting heuristic repeating-item detection to a specific subtree. |
Usage
result = await browser.extract_json(context_id=context_id)