jirutka / rsql-parser

Parser for RSQL / FIQL – query language for RESTful APIs
727 stars 155 forks source link

Is it possible to filter by the json fields? #53

Open AdrianC2000 opened 2 years ago

AdrianC2000 commented 2 years ago

I would like to achieve something like this: select * from events where params->>'name' = 'name123'; Params is the column of json type and has in it the field 'name'. So the goal is to filter by the fields that are present in the json. Is it possible with the usage of rsql parser?

qnhant5010 commented 1 year ago

It depends on how you structure your data inside Java and how you implement parsing the attribute.

arvit1 commented 1 year ago

Hello all do you have an example on how to structure the data in order to have rsql work on json column

NagVemula commented 1 year ago

So we have any update on this or idea on how we implement this feature

perfectstrong commented 1 year ago

One approach that I used in a project is to define a custom operator:

Then JPA + PostgreSQL requires some customization so that JPA "knows" the specific syntax of Postgres. Another way is to use MongoDB which has more support for the dot annotation.