# \[Visualize\]How to add Handlebars helpers?

**URL:** <https://community.postman.com/t/visualize-how-to-add-handlebars-helpers/7949>\
**Category:** Help Hub\
**Created:** [September 23, 2019, 12:23pm UTC](https://community.postman.com/t/visualize-how-to-add-handlebars-helpers/7949 "2019-09-23T12:23:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![a\_todisco](https://avatars.discourse-cdn.com/v4/letter/a/f14d63/32.png) [@a\_todisco](https://community.postman.com/u/a_todisco)\
**Post date:** [September 23, 2019, 12:23pm UTC](https://community.postman.com/t/visualize-how-to-add-handlebars-helpers/7949/1 "2019-09-23T12:23:34Z")

</div>

Hello everyone,

I’m using quite intensively Postman in my day-to-day work and I’m really found of the new Visualize API responses feature.

It’s good that this feature use Handlebars but the issue is that the basic helpers are quite simple and generally with Handlebars, you add your own helpers in order to full control your output (string format for example)

Do you know if there is a way to register helpers with new visualizer?

Thanks

Regards

---

<div class="post-metadata">

**Author:** ![udit](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/udit/32/5056_2.png) [@udit](https://community.postman.com/u/udit)\
**Post date:** [September 23, 2019, 1:03pm UTC](https://community.postman.com/t/visualize-how-to-add-handlebars-helpers/7949/2 "2019-09-23T13:03:35Z")

</div>

Hey @a_todisco, welcome to the community! 👋

Glad you like the Visualization feature!

Currently, there’s no way to register custom Handlebars helpers but we’ll consider this as a feature request. Can you specify your use case and [create a feature request](https://github.com/postmanlabs/postman-app-support/issues/new/choose) on our GitHub issue tracker?

If possible, we will add a few common helpers by default.

---

<div class="post-metadata">

**Author:** ![inthepost](https://avatars.discourse-cdn.com/v4/letter/i/b782af/32.png) [@inthepost](https://community.postman.com/u/inthepost)\
**Post date:** [October 26, 2019, 10:06pm UTC](https://community.postman.com/t/visualize-how-to-add-handlebars-helpers/7949/3 "2019-10-26T22:06:44Z")

</div>

### Update from some dude on the internet:

The feature request was made on 23sep2019. Give it a thumbs up if you’d like to see `Handlebars.registerHelper` support added to Postman’s Visualization feature.

- **add your thumbs up here \>** [https://github.com/postmanlabs/postman-app-support/issues/7373](https://github.com/postmanlabs/postman-app-support/issues/7373)

For my money, this is much preferred to adding a few built-ins/pre-set helpers.

---

<div class="post-metadata">

**Author:** ![singhsivcan](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/singhsivcan/32/1595_2.png) [@singhsivcan](https://community.postman.com/u/singhsivcan)\
**Post date:** [October 29, 2019, 3:03pm UTC](https://community.postman.com/t/visualize-how-to-add-handlebars-helpers/7949/4 "2019-10-29T15:03:06Z")

</div>

_ **Note** : Irrelevant to the feature request here._

For future readers this might be able to help them out - I wrote [this collection which will help in visualizing any JSON/CSV response in a tabular form](https://explore.postman.com/templates/3769) without writing any code (or a little in case any tweaking is required). 🙂

---

<div class="post-metadata">

**Author:** ![skplunkerin](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/skplunkerin/32/4034_2.png) [@skplunkerin](https://community.postman.com/u/skplunkerin)\
**Post date:** [March 19, 2020, 8:35pm UTC](https://community.postman.com/t/visualize-how-to-add-handlebars-helpers/7949/5 "2020-03-19T20:35:33Z")

</div>

Here’s a (really bad) work-around I’m doing since Helpers aren’t available. Sharing here (and in the Git request). Another option is to customize the full response, and just pass that in with all the changes.

**Display my timezone as a hover “title” attribute on the UTC timestamp field:**

```auto
let template = `
<table class="table table-dark">
  <tr>
      <th>UTC Timestamp (hover for MST)</th>
  </tr>
  {{#each response}}
  <tr>
      <!-- Get the formated Time from mstTimes array, for this current index -->
      <td title="{{lookup ../mstTimes @index}}">{{timestamp}}</td>
  </tr>
  {{/each}}
</table>
`;

let mstTimes = [];
// Loop over response
for (let resp in pm.response.json()){
  // For each loop index, convert timestamp to my timezone
  mstTimes.push(new Date(Date.parse(pm.response.json()[resp]["timestamp"])).toLocaleString("en-US", {timeZone: "America/Denver"}));
}

// pass mstTimes to template
pm.visualizer.set(template, {response: pm.response.json(), mstTimes: mstTimes});

```

> <https://github.com/postmanlabs/postman-app-support/issues/7373#issuecomment-601402891>
>
> Hello,
> 
> With the new visualize feature and the support of Handlebars inside Po…stman, I think it could be helpful to have the capability to register Handlebars helpers and use them.
> 
> This could be useful for example to format some string in the visualization tab like dates. It could be possible to also register the most used helpers like the ones for comparisons (a big gap in handlebars template).
> 
> This could be done by improving the pm.visulalizer
> \`\`\`
> pm.visualizer.registerHelper('if', function(conditional, options) {
> if(conditional) {
> return options.fn(this);
> }
> });
> 
> let template = {{#if isActive}}\<div\>It's wotrking\</div\>{{/if}};
> 
> pm.visualizer.set(template, {
> response: pm.response.json()
> });

---

<div class="post-metadata">

**Author:** ![payload-cosmologist8](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@payload-cosmologist8](https://community.postman.com/u/payload-cosmologist8)\
**Post date:** [September 23, 2020, 4:18pm UTC](https://community.postman.com/t/visualize-how-to-add-handlebars-helpers/7949/6 "2020-09-23T16:18:59Z")

</div>

I was also hoping for helpers to be available. I simply want to loop over a list. Since the index starts from 0, a handlebar helper to increment would be extremely useful.

```
Handlebars.registerHelper("inc", function(value, options)
{
    return parseInt(value) + 1;
});

```

I want to use the helper in the following snippet:

```
{{#each items}}
    <ol>
    <li><span class="counter">{{inc @index}}</span>{{{this.name}}}</li>
    </ol>
    {{/each}}
```
