WebScrapingAPI Docs
Web Scraping APIAdvanced API Features

JSON DOM Response

Return scraped HTML as a DOM-like JSON tree.

Use json_dom=1 when you want WebScrapingAPI to convert the target HTML into a structured DOM-like JSON tree. This works with plain HTTP scraping and can also be combined with JavaScript rendering.

Request

curl --get "https://api.webscrapingapi.com/v2" \
  --data-urlencode "api_key=YOUR_API_KEY" \
  --data-urlencode "url=https://example.com" \
  --data-urlencode "json_dom=1"

Response

The response preserves tag names, attributes, text, and child nodes.

{
  "0": {
    "tagName": "html",
    "children": {
      "0": {
        "tagName": "body",
        "children": {
          "0": {
            "tagName": "main",
            "text": "Example Domain"
          }
        }
      }
    }
  }
}

For targeted extraction, Extraction Rules are usually simpler than consuming a full DOM tree.

On this page