SQL · JSON functions

json_agg()

Aggregates rows into a JSON array. PostgreSQL; SQLite uses json_group_array().

Syntax
json_agg(expression)

Example

Open in the lab

More in this group

json ->> operator json_array() json_each json_extract() json_object() json_quote() json_remove() json_set()

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course