[Django]-Django: filter JSONField with multiple nested arrays

4👍

The structure of your contains needs to match the JSON, beginning with the first array. Each level of array in your JSON needs to be represented in the contains=

It is easier to show than to say. Like this:

MyModel.objects.filter(
     metadata__vis__plots__contains=[{'externalData': [{'source': {'name': 'FINDME'}}]}]
)

Leave a comment