What is JSON Pagination?
Pagination is an ordinal numbering, indicated by columns located at the bottom, top, or side. For JSON, pagination refers to displaying a limited chunk of data for a large dataset (for example, the first 100 results from an API response containing 1000 items). Pagination is commonly used in web applications to paginate large amounts of data and usually includes a navigation box for navigating to other pages.
The page number is usually passed as a URL parameter along with a size parameter (to limit the number of items in the response) in the API request. If no page number is passed, the default is the first page. Some API providers may use other ways to pass the page number and data limit to the server, for example, as a custom HTTP header.
API Pagination Example
Servers may have a default limit on the number of results in JSON, but instead of relying on this limit, it is recommended that you explicitly set the limit parameter in the API request to know exactly how many results will be in the JSON response.
How do I get the previous and next pages when paginating the JSON?
Paginated JSON will usually have an object with links to the previous and next JSON pages. To get the previous page, you must send a request to the "prev" URL, to get the next page, you must send a request to the "next" URL. This will deliver a new JSON with a set of new results and new links for the next and previous pages.