Integer array indexes can be divided into page buckets. Sort the elements within each aggregate to preserve the source sequence.
Worked example
SELECT key/2+1 AS page,json_group_array(value ORDER BY key) AS items FROM json_each('["a","b","c","d","e"]') GROUP BY page ORDER BY page;Result
[
{
"page": 1,
"items": "[\"a\",\"b\"]"
},
{
"page": 2,
"items": "[\"c\",\"d\"]"
},
{
"page": 3,
"items": "[\"e\"]"
}
]Implementation notes
Page labels in the example are one-based while JSON indexes are zero-based. Keep that conversion at the display boundary.
Try it yourself
Use an odd number of items and inspect the shorter last page.
Open the SQL example →Editorial date December 25, 2025 · Published December 6, 2026