Search code examples
javaarraysjsonmustache

Mustache - Extract from Array


I am trying to get the specifiy variable "x-package" out of the mustache variables. The generated JSON Variable Tree looks like this:

"tags" : [ {
    "name" : "Dummy Name",
    "x-package" : "Dummy Package"
  } ]

What I need is the Value of x-package.

My current try is:

{{#tags}}
  {{x-package}}
{{/tags}}

But all it gives me, is a empty value. (https://mustache.github.io/mustache.5.html)


Solution

  • This works:

    {{#tags}}{{#.}}{{x-package}}{{/.}}{{/tags}}
    

    {{#.}}..{{/.}} iterates over the array.