How to select select properties of a API JSON response
Options
![Chetan -2435942](https://us.v-cdn.net/6037124/user_avatars/2435942.jpg)
Chetan -2435942
Member ✭
Hello,
I have an API returning over 50 properties and 1000s of entries (records), I want to narrow down the reponse to 3 properties for all entries.
I saw a video that allows you to select one property as a path filter in the response part of XANO. Is it possible to select 3 properties together?
Lets say i only want properties A,B,D out of A,B,C,D in the following:
[
{ "A" : "1",
"B" : "2",
"C":"3",
"D": "4"
},
{ "A" : "3",
"B" : "3",
"C":"4",
"D": "6"
},
{"A":..
}
]
The output variable should thus be:
{ "A" : "1",
"B" : "2",
"D":"4"
},
{ "A" : "3",
"B" : "3",
"D":"6",
},
{"A":..
}
I have an API returning over 50 properties and 1000s of entries (records), I want to narrow down the reponse to 3 properties for all entries.
I saw a video that allows you to select one property as a path filter in the response part of XANO. Is it possible to select 3 properties together?
Lets say i only want properties A,B,D out of A,B,C,D in the following:
[
{ "A" : "1",
"B" : "2",
"C":"3",
"D": "4"
},
{ "A" : "3",
"B" : "3",
"C":"4",
"D": "6"
},
{"A":..
}
]
The output variable should thus be:
{ "A" : "1",
"B" : "2",
"D":"4"
},
{ "A" : "3",
"B" : "3",
"D":"6",
},
{"A":..
}
Comments
-
I am also curious about how to achieve this.
-
You can use the UNSET filter to remove any entries that you do not want from the variable. Seeing as you are working a list, keep in mind that you will need to Loop through the response first to manipulate it
Loop through results
Update variable (unset | path_name) -
Hi MIchael - this seems to work for removing the entries within the specified path, but how do we remove that path from the array of items all together?
-
Unset does remove the path from the array. This is why you need to use the For Each Loop to remove it from each item of the array
-
Thanks . Sorry for the confusion - my ask was the opposite of unset.
What can i use that selects 3 out of 50 columns / paths from the JSON response array?
Using unset i will have to unset 47 out of 50 to achieve this 🙂- please help -
I would create a new variable and use the SET filter to define the 3 fields you want of the new object array
-
Thanks!
-
Thank you very much
-
We are getting "unknown error has occured" for any kind of for each loop today. any issues going on?
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