> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/automate-zh/cao-zuo-zhi-nan/text-and-number/read-json.md).

# 读取json

读取 JSON 用于根据指定路径结构从一段格式为 JSON 的文本中提取值。

#### 配置参数：

* JSON 文本：需要读取的输入 JSON 文本字符串（或包含 JSON 字符串的变量）。
* 节点：指向包含所需数据的键的路径（JSON Path）。

#### 实际示例：从数据列表中获取电话号码

假设您有一个包含客户信息列表的 JSON 字符串，如下所示：

JSON

```
{
  "status": "success",
  "data": [
    {
      "name": "Nguyen Van A",
      "phone": "0987654321"
    },
    {
      "name": "Le Minh C",
      "phone": "0123456789"
    }
  ]
}
```

要提取列表中第一个人的电话号码，您配置读取 JSON 的操作：

* JSON 文本：填写上述 JSON 字符串（或传递包含该字符串的变量）。
* 节点：填写为 `data.[0].phone` *(其中 `data` 进入数据数组，`[0]` 是第一个人的位置，`phone` 是需要提取的属性)*。
* 输出变量：填写需要保存结果的变量名称（例如：`$phoneNumber`）。

结果：变量 `$phoneNumber` 将接收值为 `"0987654321"`。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gpmautomate.com/automate-zh/cao-zuo-zhi-nan/text-and-number/read-json.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
