> 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/code-examples/methods-variables-reference.md).

# Duaer 方法和变量对照

Duaer 表达式里最常用的名字：当前项用 $json，前面的节点用 $("节点名")，变量用 $vars，转换方法按数据类型分到各自的页面。
## 读取数据

- $json.字段：当前项的字段。
- $binary：当前项的文件。
- $("节点名").item、.first()、.last()、.all()：前面那个节点里对应的一项、第一项、最后一项或全部。
- $itemIndex、$runIndex：当前项序号、这个节点第几次运行。都从 0 开始。
- $vars.键名：[在 Duaer 里定义自定义变量](/zh/code/variables.md)。
- $execution.id、$workflow.name：这次执行、这条数字组织。
- $pageCount、$request、$response：只在 HTTP Request 分页里。见[在 Duaer 里使用 HTTP 节点分页变量](/zh/code/builtin/http-node-variables.md)。

## 条件和转换

- $if(条件, 甲, 乙)、$ifEmpty(值, 默认值)：选择和补默认。
- $now、$today、toDateTime()：日期。见[在 Duaer 里用 Luxon 处理日期](/zh/code/cookbook/luxon.md)。
- $jmespath(对象, "查询")：见[在 Duaer 里用 JMESPath 查询 JSON](/zh/code/cookbook/jmespath.md)。
- 字符串、数组、数字、对象、布尔、日期的方法：见[在 Duaer 里使用数据转换方法](/zh/code/builtin/data-transformation-functions.md)。
## Questions

### 在 Duaer 里当前项和前面节点分别用什么？

在 Duaer 表达式里，当前项是 $json，文件是 $binary。前面的节点是 $("节点名").item、first()、last() 或 all()。可复用变量是 $vars.键名。

### Duaer 的 $pageCount 是通用变量吗？

不是。在 Duaer 里，$pageCount、$request、$response 只在 HTTP Request 分页表达式里。其他节点读当前项仍用 $json。

