Python error load JSON code of google API

后端 未结 3 1435
闹比i
闹比i 2020-12-11 16:24

I am using google geocode API to test the following Python3.5 code but receive the error below.

raise JSONDecodeError("Expecting value", s, err

3条回答
  •  我在风中等你
    2020-12-11 17:16

    Look at the error:

    "raise JSONDecodeError("Expecting value", s, err.value) from None

    JSONDecodeError: Expecting value"

    It's saying I got a None when I was supposed to get something.

    Check your data variable for None before calling the json.loads().

    if data == None or data == '':
      print('I got a null or empty string value for data in a file')
    else:
      js = json.loads(str(data))
    

提交回复
热议问题