So I have a Discord BOT using python and I am trying to get print the JSON information using the Enjin API. I can get it to print everything if I do print(Data), but as soon as I try displaying a certain bit of information, such as the variables_values, it doesn't display and gives me the following error:
Command raised an exception: TypeError: list indices must be integers or slices, not str
I have a previous function; called Status that uses a different API, and I can get it to work with that, but I just cannot get the following code to display the values in variables_values bracket. (As you can tell, I am not great with JSON | Also, ignore the xxxxx)
async def GetVariable(message):
R = requests.get('http://www.xxxxxx.co.uk/api/m-shopping-purchases/m/47325895/user_id/19363576')
Data = R.json()
await client.say(Data["varaible_values"])
Here is what I want displayed, when I run the ?GetVariable command:
jacobdallred - which is in the "variables_values":{"Steam64ID":"jacobdallred"} place.
Instead, it gives me the error previously mentioned.
Here is what it displays if I only client.say(Data): (Uploading to Hastebin to display nicer)
https://hastebin.com/huwubiwawe.json
R.jsonis an json array, not json object