Combining JSON data from seperate sources
Hi,
I have a table of products and each product gets dynamically priced for the individual user in real time. The price is retrieved from an API call. I'm trying figure out how I can combine the products and the price data into a single JSON response that I can use as an API call.
I have attached a screenshot to try and best illustrate what I'm asking to accomplish.
Comments
-
Hi,
Are those lists in a right order and of the same length?
If yes then what I would do is create an empty array variable then run a loop and create array remove from the end/beginning for both lists then you are getting the removed elements and using update variable you can add the price to the object from the product list and afterward you are appending this new object to the empty list from the beginning. And then the loop is going for another round.
-
Hey @Pawel Magdanski, thanks for your reply. The lists are in the right order and the same length. My concern with the method you described is that perhaps for large lists (100+ items) this could become inefficient and slow?
-
Hi @mikhaeel I think for 100+ it should be reasonable in regards to time. But if the number of elements in the list will be much bigger than that then yes, that might be a problem.
I can't think of a way to do this as a bulk and merge all objects from both lists at the same time.
-
@Pawel Magdanski I'll give this a shot and see how it goes. I appreciate your 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