How To Get Complex Json Object And Render It In Views In Node Js?
I have following json with arrays in it In server I'm sending json like this getTrips: function getTrips(req, res, next){ var url = '/CTB-WS/rest/trips?from='+ req.tripinfo.fr
Solution 1:
You need to nest another loop if you wish to access each object in the sub array:
Example JSON object:
{
"array": [
{
"property": "Hello",
"nestedArray": [
{
"nestedArrayProp": "World"
}
]
}
]
}
Example Jade template:
each object in array
each nestedObject in object.nestedArray
p= object.property + ' ' + nestedObject.nestedArrayProp
Which will output:
<p>Hello World</p>
Post a Comment for "How To Get Complex Json Object And Render It In Views In Node Js?"