Zedak
Zedak

Reputation: 289

Python JSONDecodeError: Expecting ',' delimiter

This is the first time I am working with json files. I have a json file

{
"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" : ""
        }
]}

Now I am trying to get the data form this json using

with open('schema-map.json') as json_data:
d = json.load(json_data)
print(d)

I get the following error.JSONDecodeError: Expecting ',' delimiter I want to know If there is anything wrong with the json file, or the code could be modified.

Upvotes: 1

Views: 13638

Answers (1)

Tim B
Tim B

Reputation: 3133

You're JSON file is missing a closing } bracket to close the field-map group.

{
"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" : ""
        }
    }
]}

Upvotes: 2

Related Questions