Filters/Functions to convert an Object into an Array of Primitives? (RESOLVED: See Solution)
Options
Umair Kamil
Member ✭
Hi Team,
I've done it but am looking for a better way.
1. User inputs JSON
2. Create a variable which takes the JSON input and converts it into an object (array filter: first) --> variable called "object"
3. Create a variable called "keys" which applies the "keys" filter to object --> variable called "keys"
4. Create a variable called "values" which applies the "values" filter to object --> variable called "values"
5. Run a For Each Loop on the "index"
6. Create a variable which gets the "value of keys" from the "index" AND concatenates it with the "value of values" from the "index'
Is there any function/filter that can do this directly?
I am perfectly fine if some direct filter leads to an ouput like
array_of_primitives: ["name: umair", "age: 28", "location: Islamabad" ]
[Screen Shot 2022-06-22 at 22.08.01 PM.png][Screen Shot 2022-06-22 at 22.08.30 PM.png][Screen Shot 2022-06-22 at 22.08.40 PM.png]
I've done it but am looking for a better way.
1. User inputs JSON
2. Create a variable which takes the JSON input and converts it into an object (array filter: first) --> variable called "object"
3. Create a variable called "keys" which applies the "keys" filter to object --> variable called "keys"
4. Create a variable called "values" which applies the "values" filter to object --> variable called "values"
5. Run a For Each Loop on the "index"
6. Create a variable which gets the "value of keys" from the "index" AND concatenates it with the "value of values" from the "index'
Is there any function/filter that can do this directly?
I am perfectly fine if some direct filter leads to an ouput like
array_of_primitives: ["name: umair", "age: 28", "location: Islamabad" ]
[Screen Shot 2022-06-22 at 22.08.01 PM.png][Screen Shot 2022-06-22 at 22.08.30 PM.png][Screen Shot 2022-06-22 at 22.08.40 PM.png]
Comments
-
Apologies! Resolved now
[Screen Shot 2022-06-22 at 23.11.23 PM.png][Screen Shot 2022-06-22 at 23.13.00 PM.png][Screen Shot 2022-06-22 at 23.11.36 PM.png] -
I was looking for something like this!!! Thank you for sharing, I am going to play/test to see if I can make it work for my case
-
Great! Let me know if you need any help!
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