[Fixed]-Django python How to insert a json containing several objects in postgresql

1👍

Your file is not a json string. If you want more than one object to insert you should user list.
your file should be as follows :
[{
"UT": "WOS:123456",
"TI": "firstpubli",
"DT": "journal",
"PY": "2016",
"TITRE" :"firstpubli2016",
"AU": "me, you"
},
{
"UT": "WOS:78910",
"TI": "secondpubli",
"DT": "journal",
"PY": "2016",
"TITRE" :"secondpubli2016",
"AU": "me, you"
}]

Also you should change your code like this :

filedata = json.load(fichier)
for f in filedata:
//object insertion here

Leave a comment