I have a json field for a model in my Django app that typically has nested json in it. I read that to filter on a JSONfield, you would use contains on the filter for whatever value you are looking for, but I'm not getting any results back even though I know the value does exist in the JSONField. Is there an extra step I need to use for nested json in a json field?
JSON Field "Field name is Content "
"content": {
"documents": [
{
"id": "378",
"name": "Test.pdf",
"mediaFile": "http://localhost:8000/media/file.pdf"
}
]
}
Query:
document_modules =
WMDocumentModule.objects.filter(content__documents__contains={'id': "378"})
>>> document_modules: <QuerySet []>