Skip to content

转换数据#

¥Transforming data

n8n 使用预定义的 数据结构,以确保所有节点都能正确处理传入数据。

¥n8n uses a predefined data structure that allows all nodes to process incoming data correctly.

你的传入数据可能具有不同的数据结构,在这种情况下,你需要对其进行转换,以便可以单独处理每个项目。

¥Your incoming data may have a different data structure, in which case you will need to transform it to allow each item to be processed individually.

例如,下图显示了 HTTP 请求 节点返回的数据与 n8n 的数据结构不兼容的输出。该节点返回数据,并显示仅返回了一个项。

¥For example, the image below shows the output of an HTTP Request node that returns data incompatible with n8n's data structure. The node returns the data and displays that only one item was returned.

HTTP Request node output

要将此类结构转换为 n8n 数据结构,你可以使用数据转换节点:

¥To transform this kind of structure into the n8n data structure you can use the data transformation nodes:

  • 聚合:将单独的项目或其部分组合成单独的项目。

¥Aggregate: take separate items, or portions of them, and group them together into individual items.

  • 限制:删除超出定义最大数量的项目。

¥Limit: remove items beyond a defined maximum number.

  • 删除重复项:识别并删除所有字段或部分字段完全相同的项。

¥Remove Duplicates: identify and delete items that are identical across all fields or a subset of fields.

  • 排序:按所需顺序整理列表,或生成随机选择。

¥Sort: organize lists of in a desired ordering, or generate a random selection.

  • 拆分:将包含列表的单个数据项拆分为多个数据项。

¥Split Out: separate a single data item containing a list into multiple items.

  • 摘要:以类似于 Excel 数据透视表的方式将项目聚合在一起。

¥Summarize: aggregate items together, in a manner similar to Excel pivot tables.