JSON: structure for paged results / result pagination

raw

facebook-cursor.json

1
2
3
4
5
6
7
8
9
10
11
12
13
{
  "data": [
     "... Endpoint data is here"
  ],
  "paging": {
    "cursors": {
      "after": "MTAxNTExOTQ1MjAwNzI5NDE=",
      "before": "NDMyNzQyODI3OTQw"
    },
    "previous": "https://graph.facebook.com/me/albums?limit=25&before=NDMyNzQyODI3OTQw"
    "next": "https://graph.facebook.com/me/albums?limit=25&after=MTAxNTExOTQ1MjAwNzI5NDE="
  }
}
raw

github.httpheaders.txt

Link: <https://api.github.com/user/repos?page=3&per_page=100>; rel="next",
  <https://api.github.com/user/repos?page=50&per_page=100>; rel="last"
raw

github.json

1
2
3
4
5
{
  "total_count": 1232,
  "incomplete_results": false,
  "items": []
}
raw

google-json.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
  "apiVersion": "2.1",
  "id": "1",
  "data": {
    "query": "chicago style pizza",
    "time": "0.1",
    "currentItemCount": 10,
    "itemsPerPage": 10,
    "startIndex": 11,
    "totalItems": 2700000,
    "nextLink": "http://www.google.com/search?hl=en&q=chicago+style+pizza&start=20&sa=N"
    "previousLink": "http://www.google.com/search?hl=en&q=chicago+style+pizza&start=0&sa=N",
    "pagingLinkTemplate": "http://www.google.com/search/hl=en&q=chicago+style+pizza&start={index}&sa=N",
    "items": [
      {
        "title": "Pizz'a Chicago Home Page"
        // More fields for the search results
      },
      "// More search results"
    ]
  }
}
 
raw

jsonapi.org-links.json

1
2
3
4
5
6
7
8
{
  "links": {
    "self": "http://example.com/articles",
    "next": "http://example.com/articles?page[offset]=2",
    "last": "http://example.com/articles?page[offset]=10"
  },
  "data": []
}
raw

jsonapi.org-next.json

1
2
3
4
5
6
7
8
9
{
    "links": {
        "first": 0,
        "last": 10,
        "prev": 1,
        "next": 3,
    },
    "data": []
}
raw

laravel-pagination.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
   "total": 50,
   "per_page": 15,
   "current_page": 1,
   "last_page": 4,
   "next_page_url": "http://laravel.app?page=2",
   "prev_page_url": null,
   "from": 1,
   "to": 15,
   "data":[
        {
            // Result Object
        },
        {
            // Result Object
        }
   ]
}
raw

stackoverflow-12168624.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
  "_metadata": 
  {
      "page": 5,
      "per_page": 20,
      "page_count": 20,
      "total_count": 521,
      "Links": [
        {"self": "/products?page=5&per_page=20"},
        {"first": "/products?page=0&per_page=20"},
        {"previous": "/products?page=4&per_page=20"},
        {"next": "/products?page=6&per_page=20"},
        {"last": "/products?page=26&per_page=20"},
      ]
  },
  "records": [
    {
      "id": 1,
      "name": "Widget #1",
      "uri": "/products/1"
    },
    {
      "id": 2,
      "name": "Widget #2",
      "uri": "/products/2"
    },
    {
      "id": 3,
      "name": "Widget #3",
      "uri": "/products/3"
    }
  ]
}
raw

thephpleague-cursor.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
        "books": [
                { "id": 6 },
                { "id": 7 },
                { "id": 8 },
                { "id": 9 },
                { "id": 10 }
        ],
        "meta": {
                "cursor": {
                        "previous": null,
                        "current": 5,
                        "next": 10,
                        "count": 5
                }
        }
}
raw

twitter.json

1
2
3
4
5
6
7
8
9
10
11
12
13
{
    "ids": [
        385752029,
        602890434,
        ...
        333181469,
        333165023
    ],
    "next_cursor": 1374004777531007833,
    "next_cursor_str": "1374004777531007833",
    "previous_cursor": 0,
    "previous_cursor_str": "0"
}
Christian Weiske Christian Weiske
owner

History