# Reference nested JSON arrays and objects in #each loop for Postman Visualizer

**URL:** <https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836>\
**Category:** Help Hub\
**Tags:** tests, loops, visualizer\
**Created:** [September 14, 2020, 10:00am UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836 "2020-09-14T10:00:03Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonasmellander](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/jonasmellander/32/5570_2.png) [@jonasmellander](https://community.postman.com/u/jonasmellander)\
**Post date:** [September 14, 2020, 10:00am UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836/1 "2020-09-14T10:00:03Z")

</div>

I’m trying to utilize the visulizer module to display information from a JSON response.  
I’m using the example code from the documentation creating a table. In the example the blob is:

```
{
    	"contacts": [
    		{
    			"name": "{{$randomFullName}}",
    			"email": "{{$randomEmail}}"
    		},
    		{
    			"name": "{{$randomFullName}}",
    			"email": "{{$randomEmail}}"
    		},
    		{
    			"name": "{{$randomFullName}}",
    			"email": "{{$randomEmail}}"
    		},
    		{
    			"name": "{{$randomFullName}}",
    			"email": "{{$randomEmail}}"
    		}
    		]
    }

```

And the test code references the “name” objects simply with {{name}} in the #each loop for response.data.contracts

My JSON looks something like this:

```
{
	"payload": [{
			"object1": 0,
			"object2": 0,
			"children": [{
				"childobject1": 1,
				"childobject2": 2,
				"children": [{
					"childobject-a": 10,
					"childobject-b": 20
				}],
				"childobject4": 3,
				"pool_member": [{
					"childobject-x": 4,
					"childobject-y": 5
				}],
				"childobject5": 8
			}],
			"object4": 100,
			"object5": 110,
			"objectkey": "test1"
		},
		{
			"object1": 0,
			"object2": 0,
			"children": [{
				"childobject1": 1,
				"childobject2": 2,
				"children": [{
					"childobject-a": 10,
					"childobject-b": 20
				}],
				"childobject4": 3,
				"pool_member": [{
					"childobject-x": 4,
					"childobject-y": 5
				}],
				"childobject5": 8
			}],
			"object4": 100,
			"object5": 110,
			"objectkey": "test2"
		}
	]
}

```

But I can’t reference for example {{children.childobject2}} (nor using {{children[0].childobject2}} ) in an #each loop for response.payload inside my template declaration.  
I suspect it has something to do with children being another array, but I can’t find the right syntax for this. Any hint as to how this can be accomplished?

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [September 14, 2020, 1:01pm UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836/2 "2020-09-14T13:01:19Z")

</div>

Hey @jonasmellander

Welcome to the community! 👋

This might be what you’re after:

```auto
var template = `
    <table>
        <tr>
            <th>A catchy title :)</th>
        </tr>
        {{#each response.payload}}
        {{#each children}}
        <tr>
            <td>{{this.childobject2}}</td>
        </tr>
        {{/each}}
        {{/each}}
    </table>
`;

pm.visualizer.set(template, {
    response: pm.response.json()
});

```

Your example request body isn’t valid JSON so I needed to fix that but this created the table in the visualizer with the number `2` in each of the table rows.

---

<div class="post-metadata">

**Author:** ![jonasmellander](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/jonasmellander/32/5570_2.png) [@jonasmellander](https://community.postman.com/u/jonasmellander)\
**Post date:** [September 14, 2020, 1:44pm UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836/3 "2020-09-14T13:44:59Z")

</div>

Thanks @danny-dainton  
Yes, that might be worth a try. I was looking at nested **#each** loops, but wanted to also use the {{@key}} counter, and couldn’t figure out if that is somehow doable with nested #each loops. Is there a way to call the the loop counters independently so to speak?  
Thanks, Jonas

---

<div class="post-metadata">

**Author:** ![jonasmellander](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/jonasmellander/32/5570_2.png) [@jonasmellander](https://community.postman.com/u/jonasmellander)\
**Post date:** [September 14, 2020, 7:40pm UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836/4 "2020-09-14T19:40:55Z")

</div>

(I have corrected the JSON in my first post now. It was not the actual JSON, and I was only trying to show the example.)  
@danny-dainton I’ve taken your example code, and indeed it works. However, when I try my real example it still doesn’t work. But that’s surely cause it doesn’t quite match my first example JSON 🙂

I have created another example in the form of a Postman collection for completeness, but as a beginner here in the forum, I’m not allowed to make attachments, so I guess one way to bypass that is to post the collection JSON as is instead. Just over 100 lines, so I hope it’s not seen as too offending. See the next post.

---

<div class="post-metadata">

**Author:** ![jonasmellander](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/jonasmellander/32/5570_2.png) [@jonasmellander](https://community.postman.com/u/jonasmellander)\
**Post date:** [September 14, 2020, 7:41pm UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836/5 "2020-09-14T19:41:32Z")

</div>

```
{
	"info": {
		"_postman_id": "340a7bee-a8ff-46af-bc52-23dcb60edb99",
		"name": "Print Tree Test Example",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Print Tree Test",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "514dbe5d-4898-4ea6-a724-e64a75437ed0",
						"exec": [
							"var template = `",
							" <style type=\"text/css\">",
							" .tftable {font-size:14px;color:#333333;width:100%;border-width: 1px;border-color: #87ceeb;border-collapse: collapse;}",
							" .tftable th {font-size:18px;background-color:#87ceeb;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;text-align:left;}",
							" .tftable tr {background-color:#ffffff;}",
							" .tftable td {font-size:14px;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;}",
							" .tftable tr:hover {background-color:#e0ffff;}",
							" </style>",
							" ",
							" <table class=\"tftable\" border=\"1\">",
							" <tr>",
							" <th>Main instance</th>",
							" <th>Pool</th>",
							" <th>Children</th>",
							" </tr>",
							" ",
							" {{#each response.data.payload}}",
							" <tr >",
							"\t <td rowspan={{this.children.childcount}}>{{instancename}}</td>",
							"\t <td rowspan={{this.children.childcount}}>{{objectkey}}</td>",
							" <td>",
							" <table class=\"tftable\" border=\"0\">",
							" {{#each this.children.pool_member}}",
							"\t <tr><td >{{this.childobject-x}}</td></tr>",
							" {{/each}}",
							" </table>",
							" </td>",
							" </tr>",
							" {{/each}}",
							" </table>",
							"`;",
							"",
							"",
							"pm.visualizer.set(template, {",
							" response: pm.response.json()",
							"});",
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"protocolProfileBehavior": {
				"disabledSystemHeaders": {
					"content-type": true
				}
			},
			"request": {
				"auth": {
					"type": "noauth"
				},
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"type": "text",
						"value": "application/json"
					},
					{
						"key": "Accept",
						"type": "text",
						"value": "application/json",
						"disabled": true
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n\t\"payload\": [\n\t\t{\n\t\t\t\"instancename\": \"object0value_0\",\n\t\t\t\"object2\": 2,\n\t\t\t\"children\": [\n\t\t\t\t{\n\t\t\t\t\t\"childobject1\": 1,\n\t\t\t\t\t\"childobject2\": \"childobject2value_0\",\n\t\t\t\t\t\"children\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"childobject-a\": \"childObject-a_0_2\",\n\t\t\t\t\t\t\t\"childobject-b\": 20\n\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\"childobject4\": 3,\n\t\t\t\t\t\"pool_member\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\"childobject-x\": \"childObject-x_0_2\",\n\t\t\t\t\t\t\"childobject-y\": 5\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\t\"childcount\": 1\n\t\t\t\t}\n\t\t\t],\n\t\t\t\"object4\": 100,\n\t\t\t\"object5\": 1,\n\t\t\t\"objectkey\": \"test1\"\n\t\t},\n\t\t{\n\t\t\t\"instancename\": \"object1value_0\",\n\t\t\t\"object2\": 0,\n\t\t\t\"children\": [\n\t\t\t\t{\n\t\t\t\t\t\"childobject1\": 1,\n\t\t\t\t\t\"childobject2\": \"childobject2value_1\",\n\t\t\t\t\t\"children\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"childobject-a\": \"childObject-a_1_2\",\n\t\t\t\t\t\t\t\"childobject-b\": 20\n\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\"childobject4\": 3,\n\t\t\t\t\t\"pool_member\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\"childobject-x\": \"childObject-x_1_2\",\n\t\t\t\t\t\t\"childobject-y\": 5\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\"childobject-x\": \"childObject-x_1_3\",\n\t\t\t\t\t\t\"childobject-y\": 6\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\t\"childcount\": 2\n\t\t\t\t}\n\t\t\t],\n\t\t\t\"object4\": 100,\n\t\t\t\"object5\": 2,\n\t\t\t\"objectkey\": \"test2\"\n\t\t}\n\t]\n}\n\t\t"
				},
				"url": {
					"raw": "https://postman-echo.com/post",
					"protocol": "https",
					"host": [
						"postman-echo",
						"com"
					],
					"path": [
						"post"
					]
				}
			},
			"response": []
		}
	],
	"protocolProfileBehavior": {}
}
```

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [September 14, 2020, 8:08pm UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836/6 "2020-09-14T20:08:03Z")

</div>

Hey @jonasmellander

This extra `data` you have here `response.data.payload` isn’t part of your response.

It’s part of the response for the visualizer example so that’s why it’s in there.

---

<div class="post-metadata">

**Author:** ![jonasmellander](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/jonasmellander/32/5570_2.png) [@jonasmellander](https://community.postman.com/u/jonasmellander)\
**Post date:** [September 14, 2020, 8:58pm UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836/7 "2020-09-14T20:58:11Z")

</div>

Hi @danny-dainton  
It’s part of the response when running this very collection and request, is it not? I added it for that very reason, and the first two columns in my HTML table do get correctly populated in the Visualizer. Or am I missing something after all?

If you look at the HTML source code in the Visualizer the second TR tag in the table has TD tags where the attributes somehow even went from “rowspan=” to just “rowspan” with the equal to sign removed as well. Not sure what causes not only the variable to be empty, but the character before it to be removed.  
I think that if we get it working in this very collection/request, I’ll be able to get it to work in my real example, as this is more identical to what I’m observing.  
Thanks for your help and efforts so far! Much appreciated.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [September 15, 2020, 11:49am UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836/8 "2020-09-15T11:49:57Z")

</div>

Not really sure what you were trying to do with `rowspan` there and you also had a table, inside a table.

```auto
var template = `
    <style type="text/css">
        .tftable {font-size:14px;color:#333333;width:100%;border-width: 1px;border-color: #87ceeb;border-collapse: collapse;}
        .tftable th {font-size:18px;background-color:#87ceeb;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;text-align:left;}
        .tftable tr {background-color:#ffffff;}
        .tftable td {font-size:14px;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;}
        .tftable tr:hover {background-color:#e0ffff;}
    </style>
    
    <table class="tftable" border="1">
        <tr>
            <th>Main instance</th>
            <th>Pool</th>
            <th>Children</th>
        </tr>
        
        {{#each response.data.payload}}
            <tr>
	            <td>{{instancename}}</td>
	            <td>{{objectkey}}</td>

                {{#each children}}
                {{#each pool_member}}
	                <td rowspan=1>{{childobject-x}}</td>
                {{/each}}
                {{/each}}
            </tr>
        {{/each}}
    </table>
`;

pm.visualizer.set(template, {
    response: pm.response.json()
});

```

With the shape of that data - It wouldn’t really look right with the current visualization:

 ![Screenshot 2020-09-15 at 12.48.02](https://us1.discourse-cdn.com/getpostman/original/3X/c/6/c6bbad0d21fe9c47efd9f0bb1467607e23ebefb3.png)

What would like the final visualization to look like? Could you provide a mock image?

---

<div class="post-metadata">

**Author:** ![jonasmellander](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/jonasmellander/32/5570_2.png) [@jonasmellander](https://community.postman.com/u/jonasmellander)\
**Post date:** [September 15, 2020, 11:58am UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836/9 "2020-09-15T11:58:56Z")

</div>

Thanks @danny-dainton  
I’ll try that out. The Rowspan was originally to make the cells of the first two columns span across multiple rows, depending on the number of children in the pool. (There’s always one main, most of the time one pool and 0-to-many children per pool.) But when I realized it was difficult to make the equivalent looping to create that HTML code (as you create new TableRows for each child cell) I redesigned and just put them all in a single nested table. (I know it’s probably ugly from a modern HTML point of view (My HTML skills stem from then last millenium 🙂 )  
But I’ll have a look at your example code and report back. I don’t believe I’m able to attach images just yet. Too much of a forum newbie 😉

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [September 15, 2020, 12:07pm UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836/10 "2020-09-15T12:07:20Z")

</div>

Does this not work for you?

> [@Help test file uploads for new Community topics](https://community.postman.com/t/help-test-file-uploads-for-new-community-topics/15110):
>
> Hey community peeps wave I need your help - I’ve noticed that lots of newer users are having issues with uploading files to new topics / existing threads. This is obviously not great when trying to show other people a particular problem that you’re having with Postman. confused Could I ask new users to reply to this message with a new image (nothing sensitive please - maybe one of your pet? dog cat bird crocodile ) or talk me through what’s currently happening when you try and uplo…

---

<div class="post-metadata">

**Author:** ![jonasmellander](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/jonasmellander/32/5570_2.png) [@jonasmellander](https://community.postman.com/u/jonasmellander)\
**Post date:** [September 15, 2020, 12:26pm UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836/11 "2020-09-15T12:26:56Z")

</div>

You’re right. I missed that button, which looks a little different in my end compared to the picture in that post. Is it only for images?

Anyways, your new code did help me to an acceptable result. Thank you very much!

```
<table class="tftable">
    <tr>
        <th>Main instance</th>
        <th>Pool</th>
        <th>Children</th>
    </tr>

{{#each response.data.payload}}
    <tr>
            <td>{{instancename}}</td>
            <td>{{objectkey}}</td>
        <td>
            <table class="tftable">
                {{#each children}}
                {{#each pool_member}}
                    <tr><td>{{this.childobject-x}}</td></tr>
                {{/each}}
                {{/each}}
            </table>
        </td>
    </tr>
{{/each}}

```

The idea was originally to create something like this:

```
<HTML>
<BODY>
<style type="text/css">
        .tftable {font-size:14px;color:#333333;width:100%;border-width: 1px;border-color: #87ceeb;border-collapse: collapse;}
        .tftable th {font-size:18px;background-color:#87ceeb;border-width: 1px;padding: 1px;border-style: solid;border-color: #87ceeb;text-align:left;}
        .tftable tr {background-color:#ffffff;}
        .tftable td {font-size:14px;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;}
        .tftable tr:hover {background-color:#e0ffff;}
    </style>
    
    <table class="tftable" border="1">
        <tr>
            <th>Main instance</th>
            <th>Pool</th>
            <th>Children</th>
        </tr>
        
            <tr id=row_1>
                <td id=1 rowspan=2>object0value_0</td>
                <td rowspan=2>test1</td>                
                <td id=subrow_1>childObject-x_0_2</td>
            </tr>
            <tr>
                <td id=subrow_2>childObject-x_0_3</td>
            </tr>
            <tr id=row_2>
                <td id=1 rowspan=3>object1value_0</td>
                <td rowspan=3>test2</td>                
                <td id=subrow_1>childObject-x_1_2</td>
                </tr>
            <tr>
                <td id=subrow_2>childObject-x_1_3</td>
            </tr>
            <tr>
                <td id=subrow_3>childObject-x_1_4</td>
			</tr>

    </table>
    </BODY>
    </HTML>

```

This is the two outputs (of course not identical data, but still):

 ![postman_visualizer_table](https://us1.discourse-cdn.com/getpostman/original/3X/c/9/c94743fd401c4f817f1a09aaaa508c2f072fdcf4.png)  
 ![Firefox_html](https://us1.discourse-cdn.com/getpostman/original/3X/b/b/bb7064b10b50b64430485863d8deeb8282f444c7.png)

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [September 15, 2020, 1:36pm UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836/12 "2020-09-15T13:36:49Z")

</div>

How about this as an alternative:

```auto
var template = `
<html>
<body>
<style type="text/css">
    .tftable {font-size:14px;color:#333333;width:100%;border-width: 1px;border-color: #87ceeb;border-collapse: collapse;}
    .tftable th {font-size:18px;background-color:#87ceeb;border-width: 1px;padding: 1px;border-style: solid;border-color: #87ceeb;text-align:left;}
    .tftable tr {background-color:#ffffff;}
    .tftable td {font-size:14px;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;}
    .tftable tr:hover {background-color:#e0ffff;}
</style>
    
<table class="tftable" border="1">
    <tr>
        <th>Main instance</th>
        <th>Pool</th>
        <th>Children</th>
    </tr>
    {{#each response.data.payload}}
    <tr>
        <td>{{instancename}}</td>
        <td>{{objectkey}}</td>
        <td>
            <table border="1">
            <tr>
                {{#each children}}
                {{#each pool_member}}
	                <tr><td>{{childobject-x}}</td></tr>
                {{/each}}
                {{/each}}
            </table>
        </td>
    </tr>
    {{/each}}
</table>
</body>
</html>
`

pm.visualizer.set(template, {
    response: pm.response.json()
});

```

 ![Screenshot 2020-09-15 at 14.35.53](https://us1.discourse-cdn.com/getpostman/original/3X/b/b/bbb9530e99ec4adb13010d6e04a910b9161e1142.png)

---

<div class="post-metadata">

**Author:** ![jonasmellander](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/jonasmellander/32/5570_2.png) [@jonasmellander](https://community.postman.com/u/jonasmellander)\
**Post date:** [September 15, 2020, 2:04pm UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836/13 "2020-09-15T14:04:25Z")

</div>

Yes, that’s pretty much what I had in my last post, isn’t it? It’s OK, but not quite as neat as the kind of table I really wanted as an output.

I tried an ugly trick trying to just JavaScript document.write, but somehow it’s not working. But I suspect that there are some limitations to the javascript that can be run in the visualizer. Or I’m simply missing some detail.  
But I find it strange that the `</tr>` after the #each loop on the left side is simply omitted in the code shown in the code inspector on the right.

 ![postman2](https://us1.discourse-cdn.com/getpostman/original/3X/6/d/6d0a17e49a090c9407303934dd857d2f640f0a66.png)

---

<div class="post-metadata">

**Author:** ![ashfaq1211](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/ashfaq1211/32/8177_2.png) [@ashfaq1211](https://community.postman.com/u/ashfaq1211)\
**Post date:** [April 20, 2021, 2:13pm UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836/14 "2021-04-20T14:13:50Z")

</div>

Hey @danny-dainton

May you please provide me with a way to visualize data of this format. The nested “filters” object has **keys that change** and the length of the “filters” object is also not fixed.

It doesn’t matter how I display them or if I’m even displaying the keys. As long as I can get the filters object to even display only it’s values, that’ll be good enough.

I have attached an image of a table structure I achieved without this nested object.

```
{
    "data": [
        {
    ​ "_id": "60640af9bca0ec48f518006a",
    ​ "name": "Gigabyte GA-H110M-DS2V Mini ATX Motherboard",
    ​ "slug": "gigabyte-ga-h110m-ds2v-mini-atx-motherboard",
    ​ "category": "601e9d389eaa02fe0042e01e",
    ​ "categorySlug": "component",
    ​ "categoryName": "Component",
    ​ "subCategory": "601ff4ad9eaa02fe0042e084",
    ​ "subCatSlug": "motherboard",
    ​ "subCatName": "Motherboard",
    ​ "productCode": "R-2021.03.05.31",
    ​ "filters": {
    ​ "processor_type": "Intel",
    ​ "generation": "7th Gen",
    ​ "ram_type": "DDR-4"
            ​}
    ​ }
    ​]
​}

```

 ![postman-visualize](https://us1.discourse-cdn.com/getpostman/original/2X/c/cfe2772e5488b78aabffe92f323aa457118a336f.png)

---

<div class="post-metadata">

**Author:** ![satellite-astronaut4](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@satellite-astronaut4](https://community.postman.com/u/satellite-astronaut4)\
**Post date:** [August 18, 2021, 2:29am UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836/15 "2021-08-18T02:29:58Z")

</div>

HI Team,  
Any one help me how to visualise this data?

{  
“self”: “zz”,  
“name”: “Service Desk Customers”,  
“id”: 10600,  
“description”: “This project role was created by JIRA Service Desk for managing customers. Please do not delete this role or edit its name.”,  
“actors”: [  
{  
“id”: 127526,  
“displayName”: “ABC”,  
“type”: “atlassian-user-role-actor”,  
“name”: “+hh”,  
“avatarUrl”: “”  
},  
{  
“id”: 149899,  
“displayName”: “+nandra1@gmail.com”,  
“type”: “atlassian-user-role-actor”,  
“name”: “f”,  
“avatarUrl”: “”  
},  
{  
“id”: 130865,  
“displayName”: “[aabelle2@ext.gmail.com](mailto:aabelle2@ext.gmail.com)”,  
“type”: “atlassian-user-role-actor”,  
“name”: “c”,  
“avatarUrl”: “”  
},  
{  
“id”: 141506,  
“displayName”: “Aaishwary Singh”,  
“type”: “atlassian-user-role-actor”,  
“name”: “b”,  
“avatarUrl”: “”  
},  
{  
“id”: 133713,  
“displayName”: “Aakash Agrawal”,  
“type”: “atlassian-user-role-actor”,  
“name”: "x,  
“avatarUrl”: “6”  
},

I am trying this but not working

var template = `  
  
.tftable {font-size:14px;color:#333333;width:100%;border-width: 1px;border-color: #87ceeb;border-collapse: collapse;}  
.tftable th {font-size:18px;background-color:#87ceeb;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;text-align:left;}  
.tftable tr {background-color:#ffffff;}  
.tftable td {font-size:14px;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;}  
.tftable tr:hover {background-color:#e0ffff;}

```
<table class="tftable" border="1">
    <tr>
            <th>ID</th>
            <th>Display Name</th>
            <th>Type</th>
            <th>Name</th>
    </tr>
    {{#each response.data.contacts}}
            {{#each actors}}
                 <tr>    
                      <td>{{this.id}}</td> 
                </tr>
            {{/each}}
            {{#each displayName}}
                 <tr>
                      <td>{{this.displayName}}</td>
                </tr>
            {{/each}}
           {{#each type}}
                 <tr>   
                       <td>{{this.type}}</td> 
                 </tr>
            {{/each}}
            {{#each name}}
                 <tr> 
                       <td>{{this.name}}</td>
                </tr>
           {{/each}}
     {{/each}}
    
   
</table>

```

`;  
pm.visualizer.set(template, {  
response: pm.response.json()  
});

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [August 24, 2023, 1:47pm UTC](https://community.postman.com/t/reference-nested-json-arrays-and-objects-in-each-loop-for-postman-visualizer/15836/16 "2023-08-24T13:47:39Z")

</div>

Closed on August 24, 2023, 1:47pm UTC


