SQLite JSON_GROUP_ARRAY() Function
Example
Return all the shipper names as a JSON array:
SELECT JSON_GROUP_ARRAY(ShipperName)
FROM Shippers;
Try it Yourself »
Definition and Usage
The JSON_GROUP_ARRAY() function is an aggregate function. It returns a JSON array with all the values in a group.
Note: Read more about JSON in the SQLite JSON chapter.
Tip: Also look at JSON_GROUP_OBJECT().
Syntax
JSON_GROUP_ARRAY(expression)
Parameter Values
| Parameter | Description |
|---|---|
| expression | Required. A column or a calculation |
Technical Details
| Return type: | Text |
|---|
More Examples
Example
Return the product names in each category:
SELECT CategoryID, JSON_GROUP_ARRAY(ProductName)
FROM Products
GROUP BY CategoryID;
Try it Yourself »