Skip to content Skip to sidebar Skip to footer

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:

eachobjectin array
  each nestedObject inobject.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?"