从Object.values nodejs

时间:2019-06-09 10:19:15

标签: node.js

var body = request.body;
for (var i = 0; i < body.data.length; i++) {
 var obj = body.data[i];
 var keys = Object.keys(obj);
 for (var i = 0; i < keys.length; i++) {
  var value = Object.values(obj[keys[i]]);
  console.log(value);
 }
}

在这里,我会像这样[{key: 'key'}, {key1: 'key1'}]

以及如何将[{key: 'key'}, {key1: 'key1'}]转换为{key: 'key'}, {key1: 'key1'}

我正在尝试Object.values(obj[keys[i]]).join();,但响应(Object, Object), (Object, Object)

0 个答案:

没有答案