> 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/action-shi-yong-zhi-nan/text-and-number/read-json.md).

# Read json

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

🎥 观看更多指导视频:[点击这里](https://youtu.be/nlEQsaxawt4)。

#### 配置参数:

* JSON Text: 需要读取的输入 JSON 文本字符串(或包含 JSON 字符串的变量)。
* Nodes: 指向包含所需数据的 key 的路径(JSON Path)。

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

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

JSON

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

要提取列表中第一个人的电话号码,您需要配置 Read json 动作:

* JSON Text: 填入上述 JSON 字符串(或传入包含该字符串的变量)。
* Nodes: 填入 `data.[0].phone` *(其中 `data` 进入数据数组,`[0]` 是第一个人的位置,`phone` 是需要获取的属性)*。
* Output variable: 填入用于保存结果的变量名(例如:`$phoneNumber`)。

结果: 变量 `$phoneNumber` 将获得值 `"0987654321"`。

<figure><img src="/files/vRt0df2THZUmhn6WZERQ" alt=""><figcaption></figcaption></figure>


---

# 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/action-shi-yong-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.
