我正在尝试将一些数据转换为这种格式,以用于名为 mustache 的模板系统:
{
"repo": [
{ "name": "resque" },
{ "name": "hub" },
{ "name": "rip" },
]
}
我目前拥有的是:
for (childIndex in scenes[sceneID].children) {
childSceneID = scenes[sceneID].children[childIndex];
childScene = scenes[childSceneID];
}
所以我需要以某种方式使每个 childScene 成为“repo”对象中的“名称”。有谁知道如何做到这一点?这是胡子文档: