How can I parse an array input?
Options
Hello!
Trying to parse webhooks from Sendgrid, but their API sends an array of objects, even if there’s just one (similar to below).
How can I use this data if the array doesn’t have any name? I’d need to know how many objects arrived, then loop each one. If I just have “example” as an input, then it won’t detect any data since it’s wrapped first inside the array that’s sent[Screen Shot 2022-08-16 at 3.26.32 PM.png]
Trying to parse webhooks from Sendgrid, but their API sends an array of objects, even if there’s just one (similar to below).
How can I use this data if the array doesn’t have any name? I’d need to know how many objects arrived, then loop each one. If I just have “example” as an input, then it won’t detect any data since it’s wrapped first inside the array that’s sent[Screen Shot 2022-08-16 at 3.26.32 PM.png]
Comments
-
For Webhooks, I'd recommend using the Get All Input (Webhook) function under utilities. This will store the inputs in a variable so that you can use it as you would normally any variable in Xano
-
This is the answer, thank you Michael! Gave it a test and it worked 🙂 The true Xano 🐐
-
This is essentially a list of objects, so create an endpoint as follow:
1. Create an input variable of type object list (send_grid_list)
2. Go to function stack - loop through send_grid_list and get the data you need from each object in the loop e.g. send_grid_list.example and assign it to a variable var_1 (which is a list of integer).
3. Run and debug, it should give you a list of your examples values. In your case; [1,2].
There are simpler ways, though.[711D89D1-FED7-4D51-BF7E-D7FDDF1D2A62.jpeg]
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