GraphQL filter on JSOn field

"@strapi/strapi": "4.14.5"


I have a JSON field on my user as follows:

"country": {
  "label": "Netherlands",
  "countryCode": "NL"

Now my playground allows me to select country, but any fields inside it does not recognize. This makes sense as it is a JSON field. How can I make a modification so that I can filter on country.code?

For now I kind of have a working solution by creating the following filter:

"country": {
        "containsi": "\"countryCode\": \"DE\""

So I match against a part of the JSON. This works but I’d like to hear if this is the best solution.

I don’t think there is a simpler approach at the moment. So would have to continue to stick to custom filters.

1 Like