Query Json Column
Options
![Pooja](https://us.v-cdn.net/6037124/user_avatars/3647922.jpg)
Pooja
Member ✭
Hi there,
I was exploring xano, in my table, I've column type json, I want to query that column, lets the column stores data like tags e.g. ["xano","lowcode"], so if I query "xano" it should return all the records having tag xano
I was exploring xano, in my table, I've column type json, I want to query that column, lets the column stores data like tags e.g. ["xano","lowcode"], so if I query "xano" it should return all the records having tag xano
Comments
-
I do this with the "in" operator in your custom query filter from "query all records". Here's a quick screenshot of a sample. You get there by adding a function, database manipulation, query all records, and then "by custom query" at which point you can add this filter:[Screen Shot 2022-03-04 at 7.54.52 AM.png]
-
Hi , thank you for the reply
I've tried with "in" operator, but it's showing me an error, here's a screenshot for reference :
[xano-custom-function.png][Xano-debug-error.png] -
What is the type of the table? If you go to database, select your table, there is a button, "show schema" above the first row. Can you click it and share a screenshot?
-
[xano-table-schema.png]
-
Got it. Given your structure, could you do tags as type text and select "list" instead of "single"? That would make it much easier to query using "in", since one side would be "known" to be an array. It's also a very common pattern for storing string-based tags, which I think is your use case
-
That table I created for demo purpose only. I want to keep the column type to JSON. Does that mean Querying Json Column is not supported?
-
I walked through how to do this in a Loom video because its a little more involved than just using the query parameter AFAIK. Hope it helps! https://www.loom.com/share/335e6fe4e5b6438ba5d63b925346c35e
-
Thank you , for walking me through how to achieve this, this was really helpful.
-
I'm so glad! Let me know if I can help further.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback