Javascript add results of query to array

I have a peice of code which loops through an array ( and then triggers a query using a value from the array(page_uuid)

I trigger the query inside a promise which ensures the results are returned.

Once the results are returned, I then loop through an array ( in the results and insert into the array ( httpuuid: item.uuid) along with some of the contents of the original array (eg. webuuid: web_uuid)

This works absolutely perfectly

const arr = //your array of things to iterate over
const query = API_RS_JS_IPM // your query to trigger for each

const promises = => {
  const web_uuid = item.webuuid;
  const web_name = item.webname; 
  const page_uuid = item.uuid;
  const page_name = item.label; 
  return query.trigger({
    additionalScope: {
      jspage: page_uuid

     response => {
      const updatedResults = => ({
        webuuid: web_uuid,
        webname: web_name,
        pageuuid: page_uuid,
        pagename: page_name,
        httpuuid: item.uuid
  return { results: updatedResults };


return Promise.all(promises)
  .then(resultsArray => resultsArray);

However, now I want to do something similar (ie. return an array to combine the first array eg, webuuid, webname, etc. with the results of the query) - however, this time, the results are not in an array (as it is a 1:1 relationship).


Simply the value I need is in data.ipm_monitor.uuid

So effectively all I need is to return an array in the promise with
webuuid (from the first array)
and data.ipm_monitor.uuid

However, Im really struggling to do this.

Can you please help?

Hi @Paul_Harvey! I would love to help but first I need more details.

1. Could you give us an example of how exactly you would like the array to look like?

2. Is the last screenshot the output of
return Promise.all(promises) .then(resultsArray => resultsArray); ?

When we are defining 'updatedResults,' we are adding key value pairs to it, all the k-v pairs from the key 'http_monitors' inside '', as well as k-v pairs for 'webuuid', 'webname', 'pageuuid', 'pagename', and 'httpuuid' that we are manually adding. That is why the results are not in an array.