node.js - Json object in jade file .and that Json object contains Array also -
i new jade,can u explain how display json object in jade file, , json object contains array please refer below json object
how read json object in jade file
{ "output": { "ftp-job": [ { "destination-cape": [ { "action code": 45, "action needed": "file_no_access", "byte transferred": 10000, "codename": "chongqing", "expectational": "3/4/2015", "file name": "spiderman3", "percent completed": 34, "total bytes": 100008 } ], "job status": "in_progress", "source": { "cpename": "la", "file name": "steadfast" }, "start date": "03/04/2014", "tenant-id": "oxide", "user-id": "admin joe" } ], "result": "ok" } } this error can read:
c:\node\nodetest2\views\userlist.jade:9 7| each user1, in userlist 8| li > 9| a(href="mailto:#{user1.result}")= (user1.ftp-job.destination-cpe.actioncode) 10| cannot read property 'destination' of undefined
edit
from can understant error message, seems typo:
a(href="mailto:#{user1.result}")= (user1.ftp-job.destination-cpe.actioncode) should mentioned @scimonster
a(href="mailto:#{user1.result}")= (user1["ftp-job"]["destination-cape"]["action code"]) how can read page, can read json object in manner:
from json:
{"book": {"name": "pippo"}} you read book.name regular javascript . notation
foo = book.name + " world" h1= foo result
<h1>pippo world</h1> node.js jade
No comments:
Post a Comment