Is JSON Response

is_json_response: boolean | false;

What's This?

Websites can share information in different ways. One common way is through web pages that we can see and read (like news articles). Another way is through structured data meant for computers to read easily, often in a format called JSON. The is_json_response option tells our scraper what kind of information to expect from the website.

How Does it Work?

  • Default (is_json_response=false): The scraper expects the website to provide information like a typical web page (HTML format).

  • With is_json_response (is_json_response=true): The scraper prepares to receive information in a structured format, specifically JSON.

When Should I Use This?

Use the is_json_response option if you're trying to get data from a source that provides structured information, like an API or a data feed. If you're unsure, and the scraped data looks like a jumbled mess, try turning this option on.

Methods

setJsonResponse(boolean) 

Configuration Name: is_json_response

Initializing Scraper

const GeonodeScraperApi = require('geonode-scraper-api');
const scraper = new GeonodeScraperApi('<Your_username>', '<Your_password>');

Using Method

scraper.setJsonResponse(true);
scraper.scrape('https://example.com/');

Using Configuration Object

const config = { is_json_response: true };
scraper.scrape('https://example.com/', config);