Hey folks,
I have managed to use the #each handlebars keyword to iterate through JSON arrays, but what if I wanted to iterate through the properties of an object (not an array) instead?
For example, say my response has an object “flags”, with a bunch of key/value pairs, basically. So, something like:
{
"flags" : {
"flag1": { /* nested properties */ },
"flag2": { /* blah blah blah */ }
}
}
Per some information I have seen on the handlebars site and forums, I should still be able to use {{#each response.flags}} and use {{@key}} for the key, and {{this}} to reference properties underneath the key.
However, when using a handlebars template in Postman, this does not appear to work. No rows are returned. I know that #each on objects was a later addition, but it appears to be in handlebars as of 2015, so it should work at this point.
Is the Postman implementation of these templates actually handlebars, or a roll-your-own thing?
Note - as a workaround, I can just use raw JS code and build the HTML table myself that way, using for (var key in response.flags), but I thought it would be nice to make use of templates where possible.
Thoughts, comments, suggestions?