Reputation: 63
Can someone help me write my jade file to properly read my variables from json?
My Json file looks like:
[
{ "name":"Little Engine","desc":"I am the first post"},
{"name":"Mighty mouse","desc":"I am the second post"}
]
I'm able to properly read the file and add it to jade using gulp. (which places the array into a "data" object.
This is where I get stuck. p=data
returns <p>[object Object],[object Object]</p>
so I know the data is getting passed through.
I can access one of the object by doing p=data[1].name
But I just can't figure out how to loop to get each object. Since I don't know how to put the # in data[#].
Upvotes: 1
Views: 1859
Reputation: 63
Ok... never mind, this was easier that I thought.
- each dot in data
p #{dot.name} ... #{dot.desc}
Thanks anyway.
Upvotes: 5