# Reformatting my json output

**URL:** <https://community.postman.com/t/reformatting-my-json-output/60231>\
**Category:** Help Hub\
**Tags:** variables, json, postman-flows\
**Created:** [April 23, 2024, 10:53am UTC](https://community.postman.com/t/reformatting-my-json-output/60231 "2024-04-23T10:53:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![njhowarth](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@njhowarth](https://community.postman.com/u/njhowarth)\
**Post date:** [April 23, 2024, 10:53am UTC](https://community.postman.com/t/reformatting-my-json-output/60231/1 "2024-04-23T10:53:17Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/b/9/b9a7d7dbcddb21e2863b418a21d49fec9bd27643.png)

---

<div class="post-metadata">

**Author:** ![flows-daniel](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/flows-daniel/32/25516_2.png) [@flows-daniel](https://community.postman.com/u/flows-daniel)\
**Post date:** [April 23, 2024, 2:28pm UTC](https://community.postman.com/t/reformatting-my-json-output/60231/2 "2024-04-23T14:28:41Z")

</div>

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:

 ![Screenshot 2024-04-23 at 10.26.03 AM](https://us1.discourse-cdn.com/getpostman/original/3X/f/8/f8bf1f263c4d7d3ddb2e59fd8eb534ab6c6688f5.png)

---

<div class="post-metadata">

**Author:** ![njhowarth](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@njhowarth](https://community.postman.com/u/njhowarth)\
**Post date:** [April 23, 2024, 4:40pm UTC](https://community.postman.com/t/reformatting-my-json-output/60231/3 "2024-04-23T16:40:58Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/c/6/c60060131f758cede5103040faa2bccc8b6087de.png)

---

<div class="post-metadata">

**Author:** ![flows-daniel](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/flows-daniel/32/25516_2.png) [@flows-daniel](https://community.postman.com/u/flows-daniel)\
**Post date:** [April 23, 2024, 6:27pm UTC](https://community.postman.com/t/reformatting-my-json-output/60231/4 "2024-04-23T18:27:18Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [May 23, 2024, 6:27pm UTC](https://community.postman.com/t/reformatting-my-json-output/60231/5 "2024-05-23T18:27:41Z")

</div>

Closed on May 23, 2024, 6:27pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
