ordinary-sapphireO
Refine2y ago
4 replies
ordinary-sapphire

filter on key inside nested JSON

[FEATURE] Deep Filtering on Nested JSON Fields in Supabase


I'm currently working on a project using Refine with Supabase as the data provider. I have a use case where I need to filter data based on a nested JSON field. However, it seems that Refine does not support deep filtering on nested JSON fields out of the box.

Here's a snippet of my current implementation:

const {{ tableProps, searchFormProps }} = useTable({{
  onSearch: (values: any) => {{
    console.log('values', values);
    return [
      {{
        field: "data->>'spanish'",
        operator: "contains",
        value: values.value,
      }},
    ];
  }},
}});

where data is a JSONB field in Postgresql containing a key named spanish.
Was this page helpful?