0

I have a JSON column that is 2 levels deep and has an array of objects at the deepest level. I want to look this up in Django. How can I do it using Django syntax? data is the json column inside my table1.

SELECT *
FROM table1, jsonb_array_elements(data->'comm') comm
where comm->>'f' in ('hello', 'hero', 'heyo')

Data Structure: data = {comm: [{f: 'hello'}, {f: 'hero'}]}

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
Kamilski81
  • 14,409
  • 33
  • 108
  • 161
  • You can filter like any other field. See [this](https://stackoverflow.com/questions/36389871/django-jsonfield-filtering) post for some ideas – DricoGrosch Feb 09 '23 at 20:05

0 Answers0