如何让json嵌套在嵌套数组中?

时间:2022-09-21 00:59:10

I need "source" with handlebars, I tried {{trailers.youtube.source}} but no response, suggestions?

我需要带把手的“来源”,我试过{{trailers.youtube.source}}但没有回应,建议?

  "trailers" : { "quicktime" : [  ],
      "youtube" : [ { "name" : "Trailer",
            "size" : "Standard",
            "source" : "vP9QCAcGy7Y",
            "type" : "Trailer"
          } ]
    },

2 个解决方案

#1


1  

Try:

尝试:

trailers.youtube[0].source

to get the first element from that array.

从该数组中获取第一个元素。

#2


0  

The solution is {{trailers.youtube.0.source}}, handlebars can't work with [].

解决方案是{{trailers.youtube.0.source}},把手不能与[]一起使用。

#1


1  

Try:

尝试:

trailers.youtube[0].source

to get the first element from that array.

从该数组中获取第一个元素。

#2


0  

The solution is {{trailers.youtube.0.source}}, handlebars can't work with [].

解决方案是{{trailers.youtube.0.source}},把手不能与[]一起使用。