https://kotlinlang.org logo
#exposed
Title
# exposed
s

Smorg

11/21/2023, 12:53 PM
Hi! I have a column which is a json field and I need to filter records based on fields in the json (rather than the json itself). Does Exposed provide an operator for this?
e

e5l

11/21/2023, 7:38 PM
@Chantal Loncle, could you please check?
🙏 1
c

Chantal Loncle

11/21/2023, 9:30 PM
Hi @Smorg, Exposed currently supports 3 functions for this, depending on how you need to use the json fields as a filter:
extract()
,
contains()
, and
exists()
. They are called on the json column and, depending on your underlying database, also allow you to provide a json path/key that matches the specific fields to search when filtering. Here are some examples of their use. In the event that none of them are the operator you're looking for, please consider opening an issue on YouTrack with the database you're using and the name of the specific operator/function you'd like to see supported.
s

Smorg

11/22/2023, 8:08 PM
extract
works. thanks, guys!
👍 1