id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 32179,Add JSONObject Func,Chiorufarewerin,Chiorufarewerin,"So I currently use for build json object for postgres like: {{{ Func( Value('name'), 'authors__name', Value('alias'), 'authors__alias', function='jsonb_build_object' ) }}} I checked other dbs formats for this, and all of this have that functional: https://www.sqlite.org/json1.html#jobj https://dev.mysql.com/doc/refman/8.0/en/json-creation-functions.html#function_json-object https://docs.oracle.com/en/database/oracle/oracle-database/12.2/sqlrf/JSON_OBJECT.html I use it for related objects, for example: {{{ class Article(models.Model): title = models.CharField(max_length=50) class Product(models.Model): article = models.ForeignKey(Article, related_name='products', on_delete=models.CASCADE) name = models.CharField(max_length=255) Product.objects.annotate( article_json=Func( Value('title'), 'article__title', function='JSONB_BUILD_OBJECT', ) ).values('name', 'article_json').first() }}} So, with JSONObject will be something like this: {{{ Product.objects.annotate( article_json=JSONObject( title='article__title', ) ).values('name', 'article_json').first() }}} ",New feature,closed,"Database layer (models, ORM)",dev,Normal,fixed,"json_object, jsonb_build_object, JSONObject",,Ready for checkin,1,0,0,0,0,0