现有一个内容不规范的json文件(books.json),需要用Python的json_normalize()函数将其标准化
file=open('books.json','r')
text=file.read()
text=json.loads(text)
json_normalize(text,'book')
运行出现错误“
raise JSONDecodeError("Expecting value", s, err.value) from None
JSONDecodeError: Expecting value
”
是怎么回事呢
json文件的内容是:
[{"writer":"Mark Ross","nationality":"USA","books":[
{"title":"XML Cookbook","price":23.56},
{"title":"Python Fundamentals","price":50.70},
{"title":"The NumPy library","price":12.30}]
},
{"writer":"Barbara Bracket","nationality":"UK","books":[
{ "title":"Java Enterprise","price":28.60},
{"title":"HTML5","price":31.35},
{"title":"Python for Dummies","price":28.00}
]
}]
慕粉1311019647
习惯受伤