在JADE中按键打印JSON对象

时间:2015-07-03 08:13:22

标签: json node.js pug

我有一个像这样的JSON对象

{
  "54634b4ea624675649e91bcd": "2014-12-04T09:21:02.622Z",
  "542e7c720fa8e288631a8298": "2014-12-04T09:21:08.672Z",
  "542c024f0fa8e288631a8285": "2014-12-19T15:28:27.092Z",
  "542beaaf0fa8e288631a8270": "2014-12-19T15:29:22.546Z",
  "542e82db0fa8e288631a8299": "2014-12-19T15:31:30.282Z",
  "542e83870fa8e288631a829a": "2014-12-19T15:32:22.758Z",
  "542e86e50fa8e288631a829c": "2014-12-19T15:33:07.509Z"
}

现在我要打印542e7c720fa8e288631a8298

2014-12-04T09:21:08.672Z的值

如何在JADE

中打印第二个键的值

我将密钥542e7c720fa8e288631a8298存储在另一个变量中。任何帮助深表感谢。

1 个答案:

答案 0 :(得分:2)

我不太了解Jade,但你可能会迭代json obj数组:

each value, key in obj
  h=key
  p=value

然后将您的变量(有密钥)与'键'。

进行比较