python - JSONDecodeError:期望值:第 2 行第 1 列(字符 2)
问题描述
我的功能如下所示:
filename = 'orderbook_file.json'
def get_line():
f = open(filename, 'r')
n_display = 0
for line in f:
data = json.loads(line)
print(data)
#if n_display % 100: continue
n_display +=1
return data
我的 json 对象是这样的:
[
{
"asks" : [
[
0.00276477,
NumberInt(9)
]
],
"bids" : [
[
0.002755,
NumberInt(544)
]
],
"lastUpdated" : 1538582700048.0
},
{
"asks" : [
[
0.00276477,
NumberInt(9)
]
],
"bids" : [
[
0.002755,
NumberInt(544)
]
],
"lastUpdated" : 1538582700048.0
}
]
当我尝试加载 json 时收到标题中的错误。该文件基本上是一个 json 对象数组。我对Json不是很熟悉,有什么帮助吗?谢谢!
解决方案
推荐阅读
- java - JCenter 弃用;对 Gradle 和 Android 的影响
- php - PHP请求没有获得价值
- facebook - 从 Facebook API 获取实时评论
- mysql - 在 asp.net core 中查询 linq
- airflow - 气流网络服务器每次都失败
- python - SQLalchemy 更新到 1.4.0 后出错
- variables - 如何在 JMeter 的 WebDriverSampler 的选择器中循环传递变量?
- android - Flutter Android UI 减少现有 PDF 的打印
- terraform - 在 Terraform 中使用另一个目录中的变量
- c++ - 使用模板的struct c ++中不同大小的数组