python - 在 Python 中解析格式错误的 JSON 数据集的问题
问题描述
我很难从故意格式错误的 JSON 数据集创建熊猫数据框。我遇到的困难是,dirtyjson 似乎只是解析并将一个条目写入输出文件,而不是整个 JSON 文件:
# load json files into python
with open ('neither.json') as neither:
neither_data = dirtyjson.load(neither)
neither_parsed = json.dumps(neither_data)
with open ('json_file_neither','w') as outfile:
json.dump(neither_data, outfile)
如果有人能指出如何纠正这个问题,或者如果有人能提出比 dityjson 更好的方法来清理格式错误的 JSON,我们将不胜感激。
谢谢,院长
解决方案
推荐阅读
- xamarin.forms - 使用 Xamarin Forms 在 VS for Mac 上使用 OnIdiom 的问题
- typescript - 具有动态返回类型的泛型函数
- time-series - 卷积 AE 总是过拟合时间序列——怎么了?
- macos - macOS 上 SwiftUI 中 List 中的 TextField:编辑效果不佳
- ionic-framework - 未显示播放和暂停按钮。离子角度项目
- mysql - 在 GORM 上检索记录时使用默认 MySQL 函数
- java - 在将应用程序部署到 Wildfly 8 时,我收到 NoClassDefFoundError,但它成功启动、工作并使用给定的类
- azure-active-directory - 添加 Azure AD 连接服务会覆盖 AAD 门户中的重定向 URI
- angular - 无法从可观察对象更改对象的字段(设置新值)
- mfc - MFC 复选框 GetCheck() bool 以看似相同的属性意外返回,尽管单击了按钮