
G2 Data API: Extract Structured JSON in 2026
Learn how to extract structured JSON data from G2 reviews using AlterLab's Extract API with schema-based validation and no HTML parsing.
AlterLab handles this automatically — scrape any URL with one API call. No infrastructure required.
Try it freeThis 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 for setup.
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:
{
"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 for full reference.
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.
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 page—charges are per successful extraction with no minimums and credits that never expire.
Extract structured reviews data from G2
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.
Was this article helpful?
Frequently Asked Questions
Related Articles

Rate My Professors Data API: Extract Structured JSON in 2026
Learn how to extract structured JSON from Rate My Professors pages using AlterLab's Extract API — schema‑defined, typed output, no HTML parsing needed.
Herald Blog Service

Crexi Data API: Extract Structured JSON in 2026
Build a reliable real-estate data pipeline using a crexi data api approach. Learn to extract structured JSON for pricing, addresses, and property specs.
Herald Blog Service

How to Scrape Shopee Data: Complete Guide for 2026
Learn how to scrape Shopee data efficiently using Python and Node.js. This guide covers handling anti-bot protections, using Cortex AI for extraction, and scaling pipelines.
Herald Blog Service
Popular Posts
Recommended

How to Scrape AliExpress: Complete Guide for 2026

Why Your Headless Browser Gets Detected (and How to Fix It)

AlterLab vs Firecrawl: In-Depth Review with Benchmarks & Code Examples

How to Scrape Twitter/X Data: Complete Guide for 2026

How to Scrape Cloudflare-Protected Sites in 2026
Newsletter
Scraping insights and API tips. No spam.
Recommended Reading

How to Scrape AliExpress: Complete Guide for 2026

Why Your Headless Browser Gets Detected (and How to Fix It)

AlterLab vs Firecrawl: In-Depth Review with Benchmarks & Code Examples

How to Scrape Twitter/X Data: Complete Guide for 2026

How to Scrape Cloudflare-Protected Sites in 2026
Stay in the Loop
Get scraping insights, API tips, and platform updates. No spam — we only send when we have something worth reading.
Explore AlterLab
Web Scraping API Resources
Part of the Web Scraping API Documentation cluster
Complete API reference with 5-tier auto-escalation — Curl to challenge resolution.
Pillar pageConfigure Tier 4 browser rendering for SPAs and dynamic content.
Scrape pages behind login using session management.
Real success rates and cost data across all 5 tiers.
MCP Server, Python SDK, and Firecrawl-compatible API for AI agent workflows.