json_response=true, Zenrows captures not only the final HTML content but also all XHR, Fetch, and AJAX requests made during page rendering. This gives you complete visibility into how modern web applications load and update their content.
js_render=true to function, as it monitors network activity and JavaScript execution within the browser environment.How JSON Response works
JSON Response intercepts and records most network activity during JavaScript rendering, creating a comprehensive report of the page’s behavior. The browser monitors every HTTP request made by the page, including background API calls, resource loading, and dynamic content updates. This process captures:- All XHR and Fetch requests with full request/response details
- The final rendered HTML content
- Optional JavaScript instruction execution reports
- Optional screenshot data of the rendered page
- Complete request and response headers for network analysis
Basic usage
Enable JSON Response by adding thejson_response=true parameter to your JavaScript rendering request:
JSON Response structure
The JSON Response contains several key fields that provide different types of information. Here’s a complete example of what a typical JSON response looks like:Response fields
-
html- The complete rendered HTML content of the page as a string. This content is JSON-encoded and contains the final DOM state after all JavaScript execution and dynamic loading. -
xhr- An array containing all XHR, Fetch, and AJAX requests made during page rendering. Each request object includes:url- The complete URL of the requestbody- The response body contentstatus_code- HTTP status code (200, 404, 500, etc.)method- HTTP method used (GET, POST, PUT, DELETE, etc.)headers- Response headers from the serverrequest_headers- Headers sent with the original request
-
js_instructions_report(Optional - only present when using JavaScript Instructions) - Detailed execution report including:instructions_duration- Total execution time in millisecondsinstructions_executed- Number of instructions processedinstructions_succeeded- Number of successful instructionsinstructions_failed- Number of failed instructionsinstructions- Array of individual instruction details with parameters, success status, and timing
-
screenshot(Optional - only present when using the Screenshot feature) - Screenshot data containing:data- Base64-encoded image datatype- Image format (typically “image/png”)width- Screenshot width in pixelsheight- Screenshot height in pixels
When to use JSON Response
JSON Response is essential for these scenarios:Dynamic content loading:
- AJAX-loaded content - When page content is loaded dynamically via XHR calls, JSON Response captures these API requests so you can access the raw data directly from the network calls rather than parsing it from the rendered HTML
- API-dependent data - Content that appears after external API calls
- Progressive loading - Pages that load content in stages
- Conditional content - Elements that appear based on user state or preferences
- Real-time applications - Capture live data feeds and WebSocket-like communications
- Search platforms - Monitor search API calls and result loading patterns
Debugging and development:
- Network troubleshooting - Identify failed requests or slow API calls
- Content loading analysis - Understand how content loads in stages
- Performance monitoring - Track request timing and response sizes
- Integration testing - Verify that all expected API calls are made
- Security analysis - Monitor for unexpected network activity
- JavaScript Instructions debugging - When using JavaScript Instructions, JSON Response provides detailed execution reports to help debug instruction failures and timing issues
Best practices
Combine with appropriate parameters
Use JSON Response with other features such aswait or wait_for to guarantee the content will be loaded:
Filter and process network requests
Focus on relevant requests to avoid information overloadTroubleshooting
Common issues and solutions
Handling oversized responses
When JSON responses become too large and exceed your plan’s limits: Response size exceeded error: If your response exceeds the maximum size allowed by your plan, you’ll receive an error indicating the limit has been reached. Solutions:- Upgrade your plan - Higher-tier plans support larger response sizes
- Use Block Resources parameter - Remove unnecessary content like images, stylesheets, and scripts:
- Filter XHR requests - Focus on specific API endpoints rather than capturing all network activity
- Use shorter wait times - Reduce the time window to capture fewer requests
Debugging missing network requests
When expected API calls don’t appear in the XHR array:Verify if XHR requests are actually made
Increase wait time for slow requests
Use `wait_for` to ensure content loads
Pricing
Thejson_response parameter doesn’t increase the request cost on its own. Cost still depends on js_render and premium_proxy, exactly as it would for a standard request.
Frequently Asked Questions (FAQ)
Do I need js_render=true to use json_response?
Do I need js_render=true to use json_response?
json_response parameter requires js_render=true because it monitors network activity that occurs during JavaScript execution. Without JavaScript rendering, there would be no XHR/Fetch requests to capture.Will json_response capture all network requests made by the page?
Will json_response capture all network requests made by the page?
How large can the JSON response become?
How large can the JSON response become?
Can I get only the XHR data without the HTML content?
Can I get only the XHR data without the HTML content?
What happens if a network request fails during page loading?
What happens if a network request fails during page loading?
Can I use json_response to monitor WebSocket connections?
Can I use json_response to monitor WebSocket connections?
How do I handle pages that make requests after user interactions?
How do I handle pages that make requests after user interactions?