python - Python json.loads 导致额外数据异常
问题描述
这是我的文件的样子:
我的代码
import json
with open(r'c:\sample.json') as json_file:
data = json.load(json_file)
我得到了这个错误:
Extra data: line 18 column 2 (char 294)
这是什么意思 ?什么额外的数据?
解决方案
一个json文件只能是一个数据结构,如果你想在里面放多个dict,那么你可以把它们放在一个列表中
[
{...},
{...},
...
]
推荐阅读
- python - 我如何转换python编码解码
- network-programming - 无向链和二叉树的度分布
- c - 使用 openMP 并行填充直方图
- javascript - 如何将容器保持按钮放入代码中
- java - “源服务器没有找到目标资源的当前表示或不愿意透露存在的表示”的问题。
- node.js - 构建 Angular 项目((node:20072) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') 已弃用)
- math - Three.js/Aframe 修复围绕球体的旋转
- html - html 和 css 文件在同一个文件夹中但未被使用
- javascript - Google Pay Passes 通行证的深层链接 - React Native
- azerothcore - ACORE API,帮助解决错误和部署