Python ValueError: No JSON object could be decoded

前端 未结 6 568
深忆病人
深忆病人 2020-12-30 07:41

I\'m trying to read a json and get its values. I have a folder with the JSON\'s archives, and I need to open all archives and get the values from them.

This is the c

6条回答
  •  梦谈多话
    2020-12-30 08:02

    The reply suggesting that .read() was moving the cursor led to a resolution of my version of the problem. I changed

    print response.read()
    ...
    json_data = json.loads(response.read())
    

    to

    responseStr = response.read()
    print responseStr
    ...
    json_data = json.loads(responseStr)
    

提交回复
热议问题