python爬虫中遇到requests payload 内容为{hdConditions: {,…}, others: {}, page: 1, rows: 20} hdConditions : {,…} hdPredicates : [{hdClauses: [{column: "planDte", value: "2023-06-07", operation: ">=", conjunction: "and"},…]}] 0 : {hdClauses: [{column: "planDte", value: "2023-06-07", operation: ">=", conjunction: "and"},…]} hdClauses : [{column: "planDte", value: "2023-06-07", operation: ">=", conjunction: "and"},…] 0 : {column: "planDte", value: "2023-06-07", operation: ">=", conjunction: "and"} column : "planDte" conjunction : "and" operation : ">=" value : "2023-06-07" 1 : {column: "planDte", value: "2023-06-10", operation: "<=", conjunction: "and"} column : "planDte" conjunction : "and" operation : "<=" value : "2023-06-10" 2 : {column: "checkId", value: "%", operation: "like", conjunction: "and"} column : "checkId" conjunction : "and" operation : "like" value : "%" others : {} page : 1 rows : 20 帮我转换成可识别的josn类型
时间: 2023-07-06 20:39:31 浏览: 84
可以使用Python中的json模块将payload转换成JSON格式。具体代码如下:
```python
import json
payload = {
"hdConditions": {
"hdPredicates": [
{
"hdClauses": [
{
"column": "planDte",
"value": "2023-06-07",
"operation": ">=",
"conjunction": "and"
},
{
"column": "planDte",
"value": "2023-06-10",
"operation": "<=",
"conjunction": "and"
},
{
"column": "checkId",
"value": "%",
"operation": "like",
"conjunction": "and"
}
]
}
]
},
"others": {},
"page": 1,
"rows": 20
}
payload_json = json.dumps(payload)
print(payload_json)
```
输出的结果为:
```json
{"hdConditions": {"hdPredicates": [{"hdClauses": [{"column": "planDte", "value": "2023-06-07", "operation": ">=", "conjunction": "and"}, {"column": "planDte", "value": "2023-06-10", "operation": "<=", "conjunction": "and"}, {"column": "checkId", "value": "%", "operation": "like", "conjunction": "and"}]}]}, "others": {}, "page": 1, "rows": 20}
```
阅读全文