How can I use a variable to locate an Object property for Update?
I have an external API response which returns a list of codes.
{
"id": "401547429626",
"sequenceNumber": "62600",
"type": {
"id": "5",
"text": "xxx",
"abbreviation": "xxx"
},
{
"id": "401547429648",
"sequenceNumber": "64800",
"type": {
"id": "24",
"text": "Pass Reception",
"abbreviation": "REC"
}
I have an object which containing properties aligning to the returned Id's, i.e. 5, 24, etc.
"5": {
"homeTeam": {
"playTypeId": 5,
"playTypeDec": "Sacks",
"count": null
}
I am looping through the API response and need to update my object using the "id". How do I dynamically reference the object property (the existing variable)?
Apologies I am very new to the product. Much appreciated.
Best Answer
-
if you go with "for loop" with array as input, and did not edit default output, then inside a loop your current object from array will be a var "item". therefore u can reference item.id
Answers
-
Thank you for your suggestion. I'll try that. Much appreciated.
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