Python 解析JSON API

Python 解析JSON API,python,json,api,parsing,decode,Python,Json,Api,Parsing,Decode,最近我只是尝试解析一个JSON API,我不知道它是如何工作的JSON模块创建的列表。这就是代码 import json import requests r = requests.get('https://api.coinmarketcap.com/v1/ticker/bitcoin/') print('This is the URL') print(r.url) #Json decoding bitdata = r.text bitjson = json.loads(bitdat

最近我只是尝试解析一个JSON API,我不知道它是如何工作的JSON模块创建的列表。这就是代码

import json

import requests

r = requests.get('https://api.coinmarketcap.com/v1/ticker/bitcoin/')

print('This is the URL')

print(r.url)

#Json decoding

bitdata = r.text

bitjson = json.loads(bitdata)

print (type(bitjson))

您不需要手动加载
文本。只需
jsonifed\u resp=requests.get(URL).json()
就可以了。

您不需要手动
加载
文本。简单地
jsonifed\u resp=requests.get(URL).json()
就可以了。

根据,要获得json响应,您需要使用
.json()

根据,要获得JSON响应,您需要用户
.JSON()

r = requests.get('https://api.coinmarketcap.com/v1/ticker/bitcoin/')
print(r.json())