1👍
✅
I found a solution in this Django ticket:
Map.objects.annotate(num_locations=Func('locations', function='jsonb_array_length', output_field=IntegerField()))
Source:stackexchange.com