📜  连接键 json - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:13.235000             🧑  作者: Mango

代码示例1
finalStr = ''
Object.keys(obj).forEach(function(key) {
  if (obj[key].name === 'mountpoints') { // only get sizes for mountpoints
    var value = obj[key].value;
    Object.keys(value).forEach(function(name) { // add all sizes to string
      finalStr += '"' + name + '" - ' + value[name].size + ';';
    }); //update
  }
}); //update

if (finalStr.length > 0) { // at least one entry was added
  finalStr.slice(0, -1);
}