我的功能如下:
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不太熟悉,有什么帮助吗?谢谢!