Looking Up Data from One Array to a Second Array

Hello all, thank you for the great resource that this forum is.
I am looking for some assistance in looking up variables.

For example, if I have an "Array1" that returns:


I can save these into something like global.lookup

Now if I have another Array2 from a different endpoint that returns:


How do I look up the name on the Array2 from the global.lookup
Ideally I would like to convert all the label_ids to each contain and array with "id" and "name"
At the minimum I would like replace the "label_ids" in Array2 with "name" from Array1 for the entire array.
I could do it with If statements, but it is really messy especially if new labels get added.
Thank you very much for your assistance.

Hi @CHR1ST00

before diving into code, could you provide an example of the output you'd like given the example inputs you've shared? Helps to avoid any misinterpretation of what you've written.

Hello knolleary,

Thank you for your reply
According to my example above
Instead of :


I would like:


Not sure if I have explained that exceptionally well.