只使用EJS来浏览json密钥

如果只使用EJS(在EJJ模板的.ejs文件中用于NodeJS),我将如何迭代JSON对象(不是数组)的键?

我正在寻找这样的东西:

JSON对象如下所示:

the_object = { 1: "belongs to id 1", 3: "belongs to id 3", 12: "belongs to id 12" } 

有些EJS模板是这样的:

 <% for (key, value: the_object) { %> <li>the key is: <%= key %></li> <% } %> 

为了产生这样的东西:

  • 关键是:1
  • 关键是:3
  • 关键是:12
  • 这可能吗?

      <% Object.keys(the_object).forEach(function (key) { %> <li>the key is: <%= key %></li> <% }) %>