我正在尝试解析具有以下格式的JSON文件
[
{
"name":"name1",
"age":"age1"
},
{
"name":"name2",
"age":"age2"
},
{
"name":"name3",
"age":"age3"
}
]
当我在python中使用JSON解析器时,我收到以下错误:
> ValueError: No JSON object could be decoded
这是我的代码:
import json
with open('sample.json') as data_file:
data = json.load(data_file)
print(data)