猿问

python3 json文件规范化问题(normalize)

现有一个内容不规范的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
浏览 6955回答 2
2回答

慕粉1311019647

我也没看出来

习惯受伤

没看出来格式有什么错误?
随时随地看视频慕课网APP
我要回答