-
Notifications
You must be signed in to change notification settings - Fork 656
Open
Labels
Description
Verify steps
- Tracker 我已经在 Issue Tracker 中找过我要提出的问题
- Need 当前 QD 框架并不包含该功能特性或者还不完善
- Framework 这是 QD 框架应包含的特性,并非模板特性
- Meaningful 我提交的不是无意义的 催促更新或修复 请求
Describe the Feature
许多网站的API返回的数据都是json格式,但是目前QD框架只支持使用正则表达式提取API的结果,对于一些稍复杂的返回结果,不便于提取,且如果返回结果中存在嵌套的转义字符(",{}:等)时正则表达式容易匹配到错误的数据。假设某网站API返回如下形式的数据
{
"admin": [
{"name": "Admin", "age": 28, "email": "admin@example.com"}
],
"users": [
{"name": "Alice", "age": 25, "email": "alice@example.com"},
{"name": "Bob", "age": 30, "email": "bob@example.com"},
{"name": "Charlie", "age": 28, "email": "charlie@example.com"}
]
}而我只希望提取users的email时,正则表达式非常困难。使用JSONPath的话可以直接使用 $.users[*].email 获得。
如果可以的话,希望作者在QD2的路线图中考虑此功能,谢谢~
Describe the solution
当网站返回的响应是Content-Type: application/json时,支持使用JSONPath来提取数据。可以考虑使用JSONPath的库 https://github.com/h2non/jsonpath-ng
Describe alternatives
No response
Additional context
No response
Reactions are currently unavailable