Reformatting my json output

I’m a newb on the flows but I have got really stuck on this and would appreciate any direction, since I can’t find anything to help.
Im creating a test flow to grab a play list out of spotify and drop it into a google sheet. Nothing to complex right?
However I have hit a snag. There are nulls in my playlist so I am using an if to remove them then using a collect to gather it all back together without nulls.
I tried to use a template to format it to later pass a put call but the josn formatting is all off.
Looking at the log it looks like the flow has added a [ at the start and a ] at the end and then lots of " and a bunch of /n/r
Is the an easy/better way to reformat/do this? Like I say, total newb so all comments welcome. I have added a screenshot for visability.

Hi @njhowarth

The template block is just for text, you can use the Evaluate Block instead and put it in proper JSON format with a key:value pair (collect will automatically turn it into a list). See the below Evaluate Block for formatting:

Thanks for the rapid response @flows-daniel . I really appreciate it and can see how the Evaluate is better for this than the template. Can I ask a follow on question please?

I have changed my flow as you recommended (screenshot below) however, in my final send request I can only seem to populate one row at a time (ie, changing the artistName variable to 0.artistName to grab the first row in the json). What I was looking to do was pass all of the rows through and populate all rows (in this case 4 rows of track and artist)
I had managed to create the rows previously by lopping the calls and calling the put API 4 times.
I was looking to see if I could call it once and add all 4 rows in one go to save the number of calls being carried out. Is this possible or am I looking for too much?

Thanks again for taking the time to answer.

@njhowarth

Yes you’ll need to modify the request to accept a list of values instead of just two values and then you can pass in the whole list.