AI Parsing
Extract structured JSON from any page in one Web API request, using a natural-language prompt or a JSON Schema definition.
The Web API provides structured JSON extraction in the same HTTP call that fetches the target web page. Combine output: ["json"] with the root-level json parameter to extract custom fields using either natural language prompts or strict OpenAPI / JSON Schema definitions.
json.prompt
Natural-language description of the fields to extract.
string
Dedicated parsers vs. Custom AI extraction
The Web API supports two parsing mechanisms, both returning data under the json key in the results[] array:
Built-in parser
Set output: ["json"] without providing a root json object.
Dedicated targets with pre-built parsers (e.g., /scrape/amazon/product, /scrape/google/search) and select targets using /v1/scrape (e.g. Bed Bad & Beyond product pages)
Standardized e-commerce and SERP schemas maintained by Oxylabs.
Custom AI Extraction
Set output: ["json"] and pass json: { "prompt": ... } or json: { "schema": ... } object.
Every route, including generic /v1/scrape and targets without dedicated parsers.
Custom schemas, unique page layouts, or non-standard fields.
Extraction modes: prompt vs. schema
When using custom AI extraction, the root json object accepts either a prompt string or a schema object. Do not pass both parameters in the same request.
Natural language (prompt)
Pass a natural language instruction describing the desired fields. The AI model inspects the page DOM and constructs a matching JSON object.
{
"url": "https://example.com/product/10928",
"output": ["json"],
"json": {
"prompt": "Extract the main product title, current sale price as a number, currency code, and a list of image URLs."
}
}When to use
Rapid prototyping
Experimental data extraction
Simple flat key-value extractions where exact data types are not strictly enforced later
Schema-defined (schema)
Pass a JSON Schema object conforming to the OpenAPI 3.1 / OAS 3.0 Schema specification. The extraction pipeline guarantees the response matches your defined types, nested structures, and required fields.
When to use:
Production pipelines
Automated ingestion databases
Strongly typed applications where missing or unexpected data types may cause errors
Common schema patterns
1. Repeating rows and lists
Extract search results, tables, or product listings by wrapping a row object in an array:
2. Standardized enum and nested records
Map different text across different websites into fixed internal vocabularies using enum:
For example, enum is what makes the field comparable across sites: "In stock", "Available now" and "Ships today" all land on in_stock, so downstream code branches on one value instead of large number of string matches.
3. Article and blog metadata
Extract publishing metadata for structured database storage:
Localized extraction
location applies directly to AI extractions. Pass ISO 3166-1 alpha-2 country codes to ensure localized prices and currencies are extracted correctly:
Response schema
Extracted JSON is returned inside the standard envelope under results[].json:
Code examples
Last updated
Was this helpful?