gpt4 book ai didi

Python JSONDecodeError : Expecting ',' delimiter

转载 作者:行者123 更新时间:2023-12-01 03:12:53 35 4
gpt4 key购买 nike

这是我第一次使用 json 文件。我有一个 json 文件

{
"schema-map" : [
{
"src-file": "employee_master.xlsx",
"dest-file": "employee_master.xlsx",
"field-map" : {
"user_id" : "Unique ID",
"employee_name" : "Name",
"employee_address" : "Address for Communication",
"pin_code" : "",
"employee_code" : "Codes",
"bank_account_no" : "bank_account_no",
"telephone" : "",
"email_id" : "email_id",
"pan" : "PAN Card Num",
"dependent_family_member" : ""
}
]}

现在我尝试使用

获取此 json 中的数据
with open('schema-map.json') as json_data:
d = json.load(json_data)
print(d)

我收到以下错误。JSONDecodeError:需要 ',' 分隔符我想知道json文件是否有问题,或者可以修改代码。

最佳答案

您的 JSON 文件缺少用于关闭 field-map 组的结束 } 括号。

{
"schema-map" : [
{
"src-file": "employee_master.xlsx",
"dest-file": "employee_master.xlsx",
"field-map" : {
"user_id" : "Unique ID",
"employee_name" : "Name",
"employee_address" : "Address for Communication",
"pin_code" : "",
"employee_code" : "Codes",
"bank_account_no" : "bank_account_no",
"telephone" : "",
"email_id" : "email_id",
"pan" : "PAN Card Num",
"dependent_family_member" : ""
}
}
]}

关于Python JSONDecodeError : Expecting ',' delimiter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42736000/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com