If everything is in an array you're almost there. Loop through the array to construct the sendmany variable, adding each address/value.
Each iteration add a comma to the end of the constructed variable, except for the last pair as it is not required.
Then perform the actual sendmany using the variable you have just created.