jsonb_agg_strict
Collect rows into a native JSON array.
Syntax
text
jsonb_agg_strict(value)Arguments
One SQL value per row. Skip SQL NULL values; retain a JSON null value. JSONB forms recursively normalize keys and final values. Tuple values use named/fN fields. FILTER, DISTINCT, aggregate ordering, and ordinary windows apply.
Returned value
Native JSON. No input rows returns SQL NULL; rows containing only skipped SQL NULL values produce an empty container.
Examples
sql
CREATE TABLE readings (value INTEGER);
INSERT INTO readings VALUES (1),(NULL),(2);sql
SELECT jsonb_agg_strict(value) FROM readings FORMAT csv;text
"[1,2]"