Object to Array
Options
![Knight](https://us.v-cdn.net/6037124/user_avatars/1481970.jpg)
Knight
Member ✭
I have 2 query in my API.
The first API will return results in object
{"id":1,"id":2,"id":3}
how can I turn these into an array so that I can use it on my next query to exclude? I assume I need to use subpath, but I can't loop each with something like results.*.id
The first API will return results in object
{"id":1,"id":2,"id":3}
how can I turn these into an array so that I can use it on my next query to exclude? I assume I need to use subpath, but I can't loop each with something like results.*.id
Comments
-
Can you clarify? {"id":1,"id":2,"id":3} as an object is not valid because it has the same path.
Is it perhaps:
[{"id":1},{"id":2},{"id":3}]
And what are you trying to transform it into? Just the values?
[1,2,3]? -
you are right on the objects, yes just the values, so that I can use it on my next query , Select * from
where id in [1,2,3]
-
So you can use the VALUES filter if you want to just grab the values of an object. There's a tutorial on it too
-
that's a bit diff, I have object of array
[{"hidden_chat_token":"user2"},{"hidden_chat_token":"user3"}]
but I need it to convert into array ["user2","user3] -
I see... so I would just create a new variable, name it whatever you want and just use dot notation on the existing variable object to get the results you want:
[Screenshot_2021-08-17_20-59-58.png]
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