【发布时间】:2019-02-27 12:53:12
【问题描述】:
我正在尝试从 JSON 数组中选择某些键,然后过滤其余的。
var json = JSON.stringify(body);
这是:
{
"FirstName":"foo",
"typeform_form_submits":{
"foo":true,
"bar":true,
"baz":true
},
"more keys": "foo",
"unwanted key": "foo"
}
想要我想要的:
{
"FirstName":"foo",
"typeform_form_submits":{
"foo":true,
"bar":true,
"baz":true
}
}
我已经查看了 How to filter JSON data in node.js?,但我希望在没有任何包的情况下执行此操作。
【问题讨论】: