PostgreSQLAggregate FunctionsJSON_OBJECT_AGG
JSONB_AGG

JSON_OBJECT_AGGAggregate Functions

BOOL_AND

Aggregates key-value pairs into a JSON object.

Syntax

JSON_OBJECT_AGG(key, value)

Example

Enter values below to update the example in real time.

employee_id
full_name
emp_map
employees
department_id
-- 직원 ID → 이름 매핑 JSON
SELECT JSON_OBJECT_AGG(employee_id::text, full_name) AS emp_map
FROM employees
WHERE department_id = 10;