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 (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
Search query parameters for the engine. Refer to https://serpapi.com/search-api for parameter explanations.
Optional callback.
Returns
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 (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 name. Refer to https://serpapi.com/search-api for valid engines.
Search query parameters for the engine. Refer to https://serpapi.com/search-api for parameter explanations.
Optional callback.