【发布时间】:2020-04-16 21:37:52
【问题描述】:
我在 python 3 中有这段代码
import json
with open('calldb.json', 'r') as G:
data = json.load(G)
print(data)
还有这个json文件
[
{
"n": {
"identity": 0,
"labels": [
"Service",
"Test"
],
"properties": {
"name": "Service1",
"uid": "XD2020",
"state": "new",
"type": "internetDualhome"
}
}
},
{
"n": {
"identity": 1,
"labels": [
"Test",
"intpe"
],
"properties": {
"name": "Pe1",
"ip": "172.20.20.1/32"
--------skipped lines-----------
那些省略的行是为了不共享整个文件
当我运行程序时出现此错误
从 None 提高 JSONDecodeError("Expecting value", s, err.value) json.decoder.JSONDecodeError:预期值:第 1 行第 1 列(字符 0)
这个 json 有什么问题?
【问题讨论】:
-
您的 JSON 被截断并显示“跳行”。它肯定不会那样工作。