# JSON\_PATH

从 JSON 对象中提取数据。

## 语法

```
JSON_PATH(path, JSON)
```

## 参数

| 名称 | 类型 | 描述 | 默认值 |
| --- | --- | --- | --- |
| 路径 | 字符串 | JSON 路径表达式 |  |
| JSON | 字符串 | 包含 JSON 文档的字符串 |  |

## 示例

| 路径 | JSON | 输出 |
| --- | --- | --- |
| `"$[*].author.name"` | `"[{"name": "The Great Gatsby", "author": {"name": "F. Scott Fitzgerald"}}, {"name": "Nineteen Eighty-Four", "author": {"name": "George Orwell"}}]` | `[F. Scott Fitzgerald, George Orwell]` |
| `"net_id"` | `"{ "net_id": 41 }"` | `41` |
| `"net_id"` | `"{ "net_id": [41, 42] }"` | `[41,42]` |
| `"net_id[*]"` | `"{ "net_id": [41, 42] }"` | [`41`, `42`] |
| `"net_id.parent"` | `"{ "net_id": [41, 42] }"` | null |
| `"$[*]"` | `"[1,2,3]"` | [`1`, `2`, `3`] |
| `"$[*].author"` | `"[{"name":"The Great Gatsby", "author":{"name": "F. Scott Fitzgerald"}}, {"name":"Nineteen Eighty-Four", "author": {"name": "George Orwell"}}]` | `[{"name":"F. Scott Fitzgerald"}, {"name":"George Orwell"}]` |