diff --git a/django/contrib/postgres/aggregates/general.py b/django/contrib/postgres/aggregates/general.py
index 1dda69c..6b35c93 100644
a
|
b
|
|
1 | 1 | from django.db.models.aggregates import Aggregate |
2 | 2 | |
| 3 | import json |
| 4 | |
3 | 5 | __all__ = [ |
4 | | 'ArrayAgg', 'BitAnd', 'BitOr', 'BoolAnd', 'BoolOr', 'StringAgg', |
| 6 | 'ArrayAgg', 'BitAnd', 'BitOr', 'BoolAnd', 'BoolOr', 'JsonAgg', 'StringAgg', |
5 | 7 | ] |
6 | 8 | |
7 | 9 | |
… |
… |
class BoolOr(Aggregate):
|
30 | 32 | function = 'BOOL_OR' |
31 | 33 | |
32 | 34 | |
| 35 | class JsonAgg(Aggregate): |
| 36 | function = 'JSON_AGG' |
| 37 | |
| 38 | def convert_value(self, value, expression, connection, context): |
| 39 | if not value: |
| 40 | return [] |
| 41 | return json.loads(value) |
| 42 | |
| 43 | |
33 | 44 | class StringAgg(Aggregate): |
34 | 45 | function = 'STRING_AGG' |
35 | 46 | template = "%(function)s(%(expressions)s, '%(delimiter)s')" |