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)

2 Answers2

1

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

Noah Gaeta
  • 181
  • 5
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"])
Synthase
  • 5,849
  • 2
  • 12
  • 34