Skip to content

节点返回对象、数组的时机

对象:

  • 使用data标记数据位,这样可以在字段模版中使用
js
// Loop over input items and add a new field called 'myNewField' to the JSON of each one
for (const item of $input.all()) {
  item.json.myNewField = 1;
}

return $input.all();
$input.first().json.data;

expressions 表达式

$input
$json
$json.map(item => `${item.name}(${item.age})`).join(', ')
$json.data.map(item => `${item.name}(${item.age})`).join(', ')
$json
  .filter(item => item.age > 30) // 仅保留 age 大于 30 的对象
  .map(item => `${item.name}(${item.age})`)
  .join(', ')

报错

oauthsecrets={{ $('Extract from File').item.json['cookie'] }}