0

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 think it likes the nested brackets?

Is there anyway around this?

Rudu
  • 15,682
  • 4
  • 47
  • 63
Matt
  • 1,811
  • 1
  • 19
  • 30
  • Erm, what are you asking? You can access fruit as `garden.fruit[garden.whichFruit]` – Rudu Apr 12 '11 at 16:58
  • I"m using node.js with json template. So in my html I have this: {.section garden}{.end} within that I have the code from my question. I can't do garden.fruit[garden.whichFruit] because its not json template format... see: [link](http://json-template.googlecode.com/svn/trunk/doc/Introducing-JSON-Template.html) – Matt Apr 13 '11 at 01:04

0 Answers0