Full JSON Response

Have your response organised in a JSON response for easier integration with third party apps.

The default response body received from the WebScrapingAPI contains the plain HTML scraped from the targeted URL. This approach is ideal for HTML parsing, however it can be harder to integrate with third party apps that only accept JSON format.

If you want WebScrapingAPI to organise the response in a JSON format, all you have to do is to add json_response=1 to your request. The format of the response will then be:

ElementTypeDescription

headers

Object

key : value pair of haders received from the server.

cost

int

Credit usage of your request.

initial-status-code

int

Status code received from the server.

body

string

Scraped content.

type

string

Response type. Can be html , json or b64 (for files, images, PDFs etc.)

metadata

Object

Microdata and JSON-LD extracted from the HTML file.

Your full GET request should then be sent to the following address:

https://api.webscrapingapi.com/v2?api_key=<YOUR_API_KEY>&url=<TARGETED_URL>&json_response=1

Full JSON Response Integration Examples

curl --request GET --url "https://api.webscrapingapi.com/v2?api_key=<YOUR_API_KEY>&url=https%3A%2F%2Fwebscrapingapi.com&json_response=1"

Important!** The url parameter has to be encoded.** ( i.e. &url=https%3A%2F%2Fwww.webscrapingapi.com%2F )

Response Example
{
    "headers": {
        "age": "0",
        "cache-control": "private, no-cache, no-store, max-age=0, must-revalidate",
        "content-type": "text/html; charset=utf-8",
        "date": "Wed, 24 Jul 2024 07:44:22 GMT",
        "etag": "W/\"xygdo613xj4ylz\"",
        "server": "Vercel",
        "strict-transport-security": "max-age=63072000",
        "x-matched-path": "/en",
        "x-powered-by": "Next.js",
        "x-vercel-cache": "MISS",
        "x-vercel-id": "iad1::iad1::zmtf9-1721807061993-fd48d851d7cf",
        "x-unblocker-redirected-to": "https://www.webscrapingapi.com/",
        "content-encoding": "br",
        "connection": "close",
        "transfer-encoding": "chunked"
    },
    "cost": 1,
    "initial-status-code": 200,
    "body": "<!DOCTYPE html><html lang=\"en\"><head><meta charSet=\"utf-8\"/><meta name=\"viewport\"...",
    "type": "text/html",
    "metadata": {
        "microdata": {
            "items": []
        },
        "json-ld": []
    }
}

Last updated