【发布时间】:2020-12-03 19:07:59
【问题描述】:
我已设法将我的数据从系统中取回,但其中一个字段以一长串管道分隔数据的形式返回,而不是 json 格式。
这是我的 python 脚本中的 api 调用和响应处理:
info = requests.request("GET", url, headers=headers, verify=False)
data = info.json()
return(data)
这是响应数据的净化版本。我关心的字段是“属性”字段中的数据。如何将其转换为嵌套的 json 数组?
[
{
"id": 00000001,
"name": "hostname1",
"type": "HostRecord",
"properties": "absoluteName=hostname1.mydomain.com|parentId=00000010|parentType=Zone|reverseRecord=false|addresses=10.10.10.11|addressIds=00000100|"
},
{
"id": 00000002,
"name": "hostname2",
"type": "HostRecord",
"properties": "absoluteName=hostname2.mydomain.com|parentId=00000020|parentType=Zone|reverseRecord=true|addresses=10.10.10.12|addressIds=00000200|"
}
【问题讨论】:
标签: python json python-3.x string api