Extracting Value from JSON variable : <p>I'm trying to extract a value called "balanceStr" from a web scraper I'm making, but I'm not having much luck!</p>

<p>Here's where I got so far:</p>

<pre><code>import requests
import json

url = "https://www.hpbscan.org/HpbScan/addrs/getAddressDetailInfo"
headers = {'Content-Type': 'application/json;charset=utf-8'}
body = '["0x7EC332476fCA4Bcd20176eE06F16960b5D49333e"]'

data = requests.post(url, data=body, headers=headers)

json_data = (json.loads(data.text))
#print(json_data)
print(json_data['balanceStr'])
</code></pre>

<p>If I just print(json_data) this is the output, but I'm just trying to get the value of balanceStr (36885.403...) in a variable so that I can use it like print(currentbalance)</p>

<pre><code>[
    "000000",
    "\u6210\u529f",
    {
        "addrs": {
            "accountType": null,
            "address": "0x7ec332476fca4bcd20176ee06f16960b5d49333e",
            "assetRankingOrder": "150",
            "balance": 36885403823844342504238,
            "balanceStr": "36885.40382384",
            "createTimestamp": 1569209857000,
            "fromCount": 22,
            "lastestBlock": 3951440,
            "map": {},
            "number": 229,
            "percentRate": "0.0369%",
            "startBlock": 51601,
            "toCount": 15
        },
        "hpbInstantPrice": {
            "changePercent": "-6.65%",
            "cnyPrice": "1.9890",
            "id": 1,
            "map": {},
            "updateTime": 1569210840000,
            "usdPrice": "0.2791"
        },
        "nonce": 22
    }
]
</code></pre>

<p>When I print(json_data['balanceStr']) this is the error I'm getting:</p>

<pre><code>    print(json_data['addrs'])
TypeError: list indices must be integers or slices, not str
</code></pre>

<p>Any help would be much appreciated!</p>
