```yaml
product: AlterLab
title: G2 Data API: Extract Structured JSON in 2026
category: Tutorials
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
last_updated: 2026-06-25
canonical_facts:
  - "Learn how to extract structured JSON data from G2 reviews using AlterLab's Extract API with schema-based validation and no HTML parsing."
source_url: https://alterlab.io/blog/g2-data-api-extract-structured-json-in-2026
```

This guide covers extracting publicly accessible data. Always review a site's robots.txt and Terms of Service before scraping.

## TL;DR
Use AlterLab's Extract API with a JSON schema to pull structured G2 review data. POST the target URL and schema to the Extract API endpoint and receive typed JSON—no HTML parsing required.

## Why use G2 data?
G2 hosts public product reviews that are useful for:
- Training sentiment analysis models on real‑world feedback
- Building competitive intelligence dashboards that track rating trends
- Enriching CRM records with verified purchase signals from reviewers

## What data can you extract?
From a typical G2 review page you can request:
- **product_name** – the name of the SaaS or tool being reviewed
- **rating** – the star rating shown (e.g., "4.5")
- **review_count** – total number of reviews for that product
- **category** – the G2 taxonomy category (e.g., "Customer Relationship Management")
- **verified_purchase** – flag indicating whether the reviewer confirmed purchase

These fields are publicly visible; you define them in a JSON schema and AlterLab returns them as typed values.

## The extraction approach
Raw HTTP requests return HTML that changes frequently. Parsing with regex or CSS selectors breaks when G2 updates its layout. A data API that accepts a schema and returns validated JSON removes that fragility. AlterLab handles request handling, anti‑bot measures, and AI‑driven field extraction so you receive consistent output.

## Quick start with AlterLab Extract API
First, install the client and refer to the [Getting started guide](/docs/quickstart/installation) for setup.

```python title="extract_g2-com.py" {5-12}
import alterlab

client = alterlab.Client("YOUR_API_KEY")

schema = {
  "type": "object",
  "properties": {
    "product_name": {
      "type": "string",
      "description": "The product name field"
    },
    "rating": {
      "type": "string",
      "description": "The rating field"
    },
    "review_count": {
      "type": "string",
      "description": "The review count field"
    },
    "category": {
      "type": "string",
      "description": "The category field"
    },
    "verified_purchase": {
      "type": "string",
      "description": "The verified purchase field"
    }
  }
}

result = client.extract(
    url="https://g2.com/example-page",
    schema=schema,
)
print(result.data)
```

The call returns a JSON object matching the schema, for example:
```json
{
  "product_name": "Salesforce CRM",
  "rating": "4.4",
  "review_count": "12580",
  "category": "Customer Relationship Management",
  "verified_purchase": "true"
}
```

You can achieve the same with cURL; see the [Extract API docs](/docs/api/extract) for full reference.

```bash title="Terminal"
curl -X POST https://api.alterlab.io/v1/extract \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://g2.com/example-page",
    "schema": {"properties": {"product_name": {"type": "string"}, "rating": {"type": "string"}, "review_count": {"type": "string"}}}
  }'
```

### Batch and async usage
For large‑scale jobs, fire off multiple extract requests in parallel and handle each response as it arrives.

```python title="batch_g2.py" {8-15}
import alterlab
import asyncio

client = alterlab.Client("YOUR_API_KEY")

urls = [
    "https://g2.com/products/salesforce-crm/reviews",
    "https://g2.com/products/hubspot-crm/reviews",
    "https://g2.com/products/zoho-crm/reviews"
]

schema = {
    "type": "object",
    "properties": {
        "product_name": {"type": "string"},
        "rating": {"type": "string"},
        "review_count": {"type": "string"}
    }
}

async def fetch(url):
    return client.extract(url=url, schema=schema)

async def main():
    tasks = [fetch(u) for u in urls]
    results = await asyncio.gather(*tasks)
    for resp in results:
        print(resp.data)

asyncio.run(main())
```

## Define your schema
The schema parameter drives the extraction. AlterLab validates each field against the declared type and returns only matching data. If a field cannot be found, the API returns `null` for that property, keeping the output shape predictable. You can nest objects or add arrays for lists of reviewers, but for simple review summaries a flat object works best.

## Handle pagination and scale
G2 splits reviews across pages. Retrieve the next page URL from the HTML (or from a JSON endpoint if available) and loop until no further pages exist. To stay within rate limits, space requests or use AlterLab’s built‑in concurrency controls. For cost estimates, visit the [AlterLab pricing](/pricing) page—charges are per successful extraction with no minimums and credits that never expire.

1. **Define Schema** — 
2. **Call Extract API** — 
3. **Receive Typed JSON** — 

<div data-infographic="try-it" data-url="https://g2.com" data-description="Extract structured reviews data from G2"></div>

## Key takeaways
- Use a JSON schema to ask AlterLab for exactly the fields you need from G2 pages.
- The Extract API returns typed JSON, eliminating fragile HTML parsing.
- Parallelize requests for high volume while respecting rate limits and costs.
- Always verify that your extraction target is public and complies with the site’s terms.  

AlterLab // Web Data, Simplified.

## Frequently Asked Questions

### Is there an official G2 data API?

G2 offers limited partner APIs for internal use; there is no public API for review data. AlterLab provides a compliant way to extract publicly available reviews as structured JSON.

### What G2 data can I extract with AlterLab?

You can extract fields like product_name, rating, review_count, category, and verified_purchase by defining a JSON schema; AlterLab returns validated, typed data.

### How much does G2 data extraction cost?

AlterLab charges per successful extraction; see the pricing page for pay‑as‑you-go rates with no minimums and credits that never expire.

## Related

- [Lowe's Data API: Extract Structured JSON in 2026](<https://alterlab.io/blog/lowe-s-data-api-extract-structured-json-in-2026>)
- [How to Migrate from Scrapfly to AlterLab: Step-by-Step Guide \(2026\)](<https://alterlab.io/blog/how-to-migrate-from-scrapfly-to-alterlab-step-by-step-guide-2026>)
- [Scaling Web Scraping Pipelines for High-Volume Data](<https://alterlab.io/blog/scaling-web-scraping-pipelines-for-high-volume-data>)