> For the complete documentation index, see [llms.txt](https://doc.duaer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/zh/data/data-structure.md).

# 理解 Duaer 的数据结构

在 Duaer 里，弄清节点之间如何传数据，是搭数字组织的基础。本页说明数据格式，以及数据如何在节点间流动。
## 数据结构 <a href="#data-structure" id="data-structure"></a>

在 Duaer 里，节点之间传递的都是对象数组，结构如下：

```
[
	{
		"json": {
			"apple": "beets",
			"carrot": {
				"dill": 1
			}
		},
		"binary": {
			"apple-picture": {
				"data": "....",
				"mimeType": "image/png",
				"fileExtension": "png",
				"fileName": "example.png"
			}
		}
	}
]
```

普通字段放在 json 里。文件放在同一项的 binary 里。Code 节点若漏写 json 键，运行时会补上，也会在需要时把结果包进数组。自己写的节点必须返回带 json 的项。

## 数据在节点内如何流动 <a href="#how-data-flows-within-nodes" id="how-data-flows-within-nodes"></a>

连上节点后，数据会自动从上游传到下游。节点收到一组数据项时，默认对每一项分别执行配置好的操作。

例如把某个节点设为创建卡片，并用表达式从入站字段取 Name：进来两项就会建两张卡，每张卡用当前项的那个字段。

节点设置里的 Execute Once 是例外：整组输入只跑一次。

## 拖放映射的是什么 <a href="#understand-what-youre-mapping-with-drag-and-drop" id="understand-what-youre-mapping-with-drag-and-drop"></a>

数据映射映射的是字段路径，并在运行时加载该字段的值。从 INPUT 面板把 fruit 拖进参数，会生成表达式 {{ $json.fruit }}。节点按项迭代时，该字段取当前项的 fruit。

## 理解嵌套数据 <a href="#understand-nested-data" id="understand-nested-data"></a>

表格视图里，嵌套对象会用加粗的字段名收起来。点开才能看到里面的键。表达式里要用点号走到那一层，例如 nested.example-string-field。
## Questions

### 节点之间传递的一项数据包含什么？

在 Duaer 里，输出是对象数组。每一项有 json（普通字段）；有文件时同一项还有 binary。大多数节点按项执行。

### 从输入面板拖字段会产生什么？

在 Duaer 里，会插入指向当前项的表达式，例如 {{ $json.customerId }}。这是字段路径引用，不是把当时的值抄死。

