Support conditions inside json
See original GitHub issueIs there a way adding search conditions that apply to json?
I mean, let’s say I have Users
table with a JSON column called email
(the json should be 2 fields - ‘address’ and ‘isVerified’). Now, if I want to search for a user with a specific email I would use the raw query - select * from "Users" where email->>'address' = 'abc@gmail.com';
Is there a way doing that using knex syntax?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to use if statement inside JSON? - Stack Overflow
Validating the JSON Schema Draft-07, JSON now supports the if...then...else keywords for conditional data representation.
Read more >JSON Conditions
Use the JSON_EXISTS condition to test whether a specified JSON value exists in JSON data. This condition returns TRUE if the JSON value...
Read more >Solved: I want to put if else condition in json payload
I have json payload in response . Except: If speed >50 i want to print "speed:""high" or "low". The rest of the data...
Read more >How to make IF conditions in JSON request body - ServiceNow
You should create json request based on IF condition rather than trying to add If condition within json request. 0 Helpful.
Read more >JSON Syntax - W3Schools
JSON syntax is derived from JavaScript object notation syntax: Data is in name/value pairs ... In JSON, keys must be strings, written with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
With knex the only way how to do jsonb queries is
knex.raw
.You can limit the part of raw to where it is needed like:
Only knex based DB library that I know which supports jsonb queries is objection.js. With that you can do:
No.