开发者

nested brackets in json template system, with objects

开发者 https://www.devze.com 2023-02-24 21:34 出处:网络
I\'m using a json template with node.My json returns the follow: garden = { whichFruit: \"orange\", fruit: {

I'm using a json template with node. My json returns the follow:

garden = {
   whichFruit: "orange",
   fruit: {
     orange: {color: "orange", shape: "circle"},
     apple: {color: "red", shape: "round"}
   }
}

So normally, I can just do this garden.fruit[whichFruit]

However in my json template I have:

{garden.fruit[{whichFruit}]}  

which causes an error, I don't 开发者_JAVA百科think it likes the nested brackets?

Is there anyway around this?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号