What's the best way to parse a JSON response from the requests library?

前端 未结 2 815
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 14:11

I\'m using the python requests module to send a RESTful GET to a server, for which I get a response in JSON. The JSON response is basically just a list of lists.

Wha

2条回答
  •  情话喂你
    2020-11-22 14:18

    Since you're using requests, you should use the response's json method.

    import requests
    
    response = requests.get(...)
    data = response.json()
    

    It autodetects which decoder to use.

提交回复
热议问题