Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AdrianC2000 opened this issue May 31, 2022 · 4 comments
Open

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

AdrianC2000 opened this issue May 31, 2022 · 4 comments

Comments

@AdrianC2000
Copy link

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
Copy link

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

@arvit1
Copy link

arvit1 commented Feb 10, 2023

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

@NagVemula
Copy link

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

@perfectstrong
Copy link

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

  • Having key : =k=key
  • Having key with value =kv=(key, value)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants