Visualization: How to get this deeper data out of my JSON?

Am new to Postman. This has me stumped.

JSON:
…

{
    "Jewels": [
        {
            "GemKey": "2020042gg",
            "Brand": "Jed Hodge",
            "Prices": [
                {
                    "Key": "202004240500",
                    "Code": "T3",
                    "Type": "Fin",
                    "Price": 200,
                }
            ],
            "Name": "Round Gem",

TEST TAB:
…

var template = ` 
<html lang="en">
{{#each response.Jewels}}
  <div class="card border-info mb-3" style="width: 280px; margin: 0 10 10 0; float: left">
   <div class="card-header">Price: ?{{Price}}</div>
    <div class="card-body">
      <h5 class="card-title">{{Brand}}</h5>
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
    </div>
  </div>
  {{/each}}
   </html>
     `;
pm.visualizer.set(template, {response: pm.response.json()});

VISUALIZER PROBLEM
…

I can get {{Brand}} and the visualizer displays just fine but can’t get Price.
Things that didn’t work:

{{Prices.Price}}, using {{#with Prices}}, removing the () in my visualizer.set.

How do I get Price?

Hey @cowontherun,

Welcome to the community!! :rocket:

You should be able to get that by adding {{#each Prices}}{{Price}}{{/each}} as Prices is an array, you would need to loop that to get the Price of each object.

I mocked out and extended your example slightly to show this working:

1 Like

Too easy. Ta! :grinning:

1 Like

Working with the handlebar syntax is a little tricky sometime :slight_smile:

Takes a while to get your head around it.

Glad it helped!! :trophy: