简体   繁体   中英

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 )

This works:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM