我因为无法解析这个json
响应而感到疯狂。我尝试了许多不同的方法,但没有一个能正常工作...你能帮帮我吗?
这是我正在解析的文件:
{
"info": {
"funds": {
"asset": {
"net": "12516.000",
"total": "0"
},
"borrow": {
"btc": "0",
"cny": "0",
"ltc": "0"
},
"free": {
"btc": "0",
"cny": "0",
"ltc": "0",
"eth": "0"
},
"freezed": {
"btc": "0",
"cny": "0",
"ltc": "0",
"eth": "0"
},
"union_fund": {
"btc": "0",
"ltc": "0"
}
}
},
"result": true
}
我只想要类似这样的东西:
#What I want to get the "net" which is "12516.000", so I tried this:
funds = response['info']['funds']['asset']['net']
funds = response[0]
返回 {
作为答案,而 funds = response[1]
给我返回 r
作为响应,最后,如果我尝试使用 funds = response['info']
,我会得到这个类型错误:TypeError: string indices must be integers