0

I have a JSON file that has this structure:

{
  "USD" : {"15m" : 6650.3, "last" : 6650.3, "buy" : 6650.3, "sell" : 6650.3, "symbol" : "$"},
  "AUD" : {"15m" : 10857.19, "last" : 10857.19, "buy" : 10857.19, "sell" : 10857.19, "symbol" : "$"},
  "BRL" : {"15m" : 33997.0, "last" : 33997.0, "buy" : 33997.0, "sell" : 33997.0, "symbol" : "R$"},
}

At the moment, my Python code prints out all of the AUD section. I would like to however only print out the 15m value.

My code is as follows (the link in bitcoin_api_url variable contains the JSON file request):

import requests

bitcoin_api_url = 'https://blockchain.info/ticker'

response = requests.get(bitcoin_api_url)
response_json = response.json()

print(response_json["AUD"])

I would appreciate any help, or point in the right direction (i.e. documentation)

0

2 Answers 2

1

print(response_json["AUD"]["15m"])

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much. I tried doing this for some reason: print(response_json["AUD"["15m"]])
0
import requests

bitcoin_api_url = 'https://blockchain.info/ticker'

response = requests.get(bitcoin_api_url)
response_json = response.json()

print(response_json["AUD"]["15m"])

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.