Can I query a JSON array column in the Conditions tab of the Database Query Builder?

I have key:values stored in a JSON array and want to use them to help filter the records returned through query parameters.

Example of data in JSON column:

[{
        "order": null,
        "value": "Confident",
        "max_value": null,
        "trait_type": "Upper Garb",
        "trait_count": 2347,
        "display_type": null
    }, {
        "order": null,
        "value": "Arrival",
        "max_value": null,
        "trait_type": "Rarity",
        "trait_count": 8829,
        "display_type": null
    }, {
        "order": null,
        "value": 12.8,
        "max_value": null,
        "trait_type": "Prestige",
        "trait_count": 0,
        "display_type": null
    }
]

Could I create a URL like this: mywbesite.com/collection/hoverboards?search[stringTraits][0][name]=Stabilizer&search[stringTraits][0][values][0]=Star%20Circuit

And then have something in the Condition to return records with those key:values in the traits JSON column?

As KnexJs, the underlying database connector that we use just added cross database json query support, we hope start integrating it soon!

See:

1 Like

Thanks @george! Just to confirm, there isn’t a way for me to filter the database query with data in a JSON column until you implement the package above?

Well you can always do a custom query with the database specific json query standard but it can be complex and very much database dependent

1 Like