当我使用JSON.dump()时,我低于 JSON 格式
Dumps data"b'{\"AutomaticReadabilityIndex\":2.7999999999999994,\"AgeLevel\":[\" 11 to 12\"],\"Statement\":[\"Nice. Your grade is about six\"],\"SpacheScore\":1.877,\"GunningFogScore\":9.099999999999998,\"SmogIndex\":5.999999999999999}'"
当我使用JSON.loads()时,我的字节数低于 JSON 格式
loads data b'{"AutomaticReadabilityIndex":2.7999999999999994,"AgeLevel":[" 11 to 12"],"Statement":["Nice. Your grade is about six"],"SpacheScore":1.877,"GunningFogScore":9.099999999999998,"SmogIndex":5.999999999999999}'
我的问题是,当我使用负载格式时,输出必须是字典类型,但我不知道为什么我将字符串类型作为输出。如何将此 JSON 字符串转换为字典类型。
Loads Data Type : type of loads <class 'str'>
当我尝试直接解析字符串类型 JSON 时,出现以下错误
ERROR : Traceback (most recent call last):
File "Db.py", line 84, in <module>
print(par['GunningFogScore'])
TypeError: string indices must be integers