Skip to main content
Module

x/serpapi/mod.ts>getJson

Scrape and parse search engine results using SerpApi.
Latest
function getJson
import { getJson } from "https://deno.land/x/serpapi@2.1.0/mod.ts";

Get JSON response based on search parameters.

Examples

// single call (async/await) const json = await getJson({ engine: "google", api_key: API_KEY, q: "coffee" });

// single call (callback) getJson({ engine: "google", api_key: API_KEY, q: "coffee" }, console.log);

Parameters

parameters: EngineParameters

Search query parameters for the engine. Refer to https://serpapi.com/search-api for parameter explanations.

optional
callback: (json: BaseResponse) => void

Optional callback.

Get JSON response based on search parameters.

Examples

// single call (async/await) const json = await getJson("google", { api_key: API_KEY, q: "coffee" });

// single call (callback) getJson("google", { api_key: API_KEY, q: "coffee" }, console.log);

Parameters

engine: string

Engine name. Refer to https://serpapi.com/search-api for valid engines.

parameters: EngineParameters

Search query parameters for the engine. Refer to https://serpapi.com/search-api for parameter explanations.

optional
callback: (json: BaseResponse) => void

Optional callback.