Hello. i have started to learn python. i have some basic administrative knowledge of ubuntu and minor knowledge of postgresql.
I am trying to make an api call - fetch the data, filter the data i need and upload it to postgresql database.
r2 = requests.get(api_link2)
items = r2.json()
items = json.dumps(items, indent=4, sort_keys=True)
print(items)
returns
{
"result": {
"items": [
{
"cost": 2250,
"id": 1,
"localized_name": "pretty name 1 ",
"name": "auto_name_1",
"recipet": 0,
"shop": 0,
},
{
"cost": 430,
"id": 2,
"localized_name": "pretty name 2 ",
"name": "auto_name_2",
"recipet": 0,
"shop": 0
},
i am having difficulty with itterating over items , because i get this nested dict-list-dict value, which im terrible at.
How would one print the keys, values output of item with id 2 ?