-4

I've seen an example on how to store data coming from get API to sqlite db from the following link Insert data into sqlite3 database with API. However, I couldn't understand this part of the code:

drivers = d["MRData"]["DriverTable"]["Drivers"]

Can someone please show me how we can store data from APi as shown in the shared link or at least clarification of that line of the code which I didn't understand?

Thanks

0

1 Answer 1

1

There is a nesting in the d json object. so the above example is accessing the json like this:

d =  { 
    "MrData":{
         "DriverTable":{
             "Drivers":{
                 "familyName": "albert",
                 "permanentNumber": 200
             }
         }
    }
}

I hope this illustrates what is going on

Sign up to request clarification or add additional context in comments.

7 Comments

@Joe does this clarify your confusion
Thanks Night King. In this case, the Drivers is the name of the table, so what about MrData and DriverTable? what should I replace ["MRData"]["DriverTable"] with? Thanks
can i see your own json file @Joe
Can't share the whole api response but this is a snap for it: {'data': {'name': 'edward', 'description': 'my description','date': '01-01-2020','id': 'myStringID'}}
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.