在expressjs和ejs中获取json的子键

时间:2016-09-04 16:03:10

标签: json node.js mongodb express ejs

我在这个项目中使用了expressjs,mongodb和ejs。填充dbs后,数据如下所示:

{
  _id: 5645646464,
  price: 15000,
  sellerId: {
    _id: 3543453242,
    Name: 'MrJohn'
  },
  name: 'House of MrJohn',
  category: '1'
}

现在在使用EJS的html中,我想要打印" MrJohn"在我的seller专栏中,我尝试了这个:

<%=data[i].sellerId.Name%>

但它会返回undefined

0 个答案:

没有答案