> 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="https://1806980278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiDNNiVZHPKSIcyshmOTB%2Fuploads%2Fgit-blob-376b39eb6accd6707759a2e8946432097bb3886f%2Ftn-01.png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
