Help Desk

Submit a ticket My Tickets
Welcome
Login

What are Handlebars JSON Variables and how can I use them?

The OneCloud Handlebars BizApp has many powerful features that include the ability to read a JSON payload and set variables. As an extension to this, JSON list can be dynamically parsed to create for example an HTML output that could have a list of messages from a log file. In turn, this HTML file could be the body of an email notification. Learn more about the Handlebars language.

Handlebars Template Syntax:

{{#each citibikeData.stationBeanList}}
    {{@index}} | {{stationName}} | {{totalDocks}} | {{statusValue}}
{{/each}}

Sample JSON Data:

{
  "executionTime": "2020-03-05 12:48:34 PM",
  "stationBeanList": [{
      "id": 304,
      "stationName": "Broadway & Battery Pl",
      "availableDocks": 9,
      "totalDocks": 33,
      "latitude": 40.70463334,
      "longitude": -74.01361706,
      "statusValue": "In Service"
    },
    {
      "id": 359,
      "stationName": "E 47 St & Park Ave",
      "availableDocks": 40,
      "totalDocks": 64,
      "latitude": 40.75510267,
      "longitude": -73.97498696,
      "statusValue": "In Service"
    },
    {
      "id": 367,
      "stationName": "E 53 St & Lexington Ave",
      "availableDocks": 28,
      "totalDocks": 34,
      "latitude": 40.75828065,
      "longitude": -73.97069431,
      "statusValue": "Out of Service"
    }
  ]
}

This data is available live at: https://feeds.citibikenyc.com/stations/stations.json. Use the HTTP->GET Command to download a live dataset and use the GET Output as an input into the Value area in the example below.

Handlebars Configuration with JSON Variables:

Handlebars Output:

As always, we welcome questions on this post or feel free to contact us at support@onecloud.io.


1 person has this question
Login to post a comment