I need to save json file from API in database (postgresql) using django. I have classic model which extends the AbstractUser with the default fields for first name, last name and etc. I made a research but can't find how to achieve saved json from API in database while using django. I will appreciate any help or guide.
Asked
Active
Viewed 1,044 times
2 Answers
2
I think JSONField is the best choice for you. In the meantime, do you really want to store API response? Maybe you should just extract some information from it?

Dmitry Belaventsev
- 6,347
- 12
- 52
- 75
-
Yes, I need to store the information from the API in my database, and then visualize some of the fields in tables. Thank you for the suggestion, JSONField will work for me. – Nov 10 '20 at 08:46
1
It's preferable to use the Jsonb field option. While JSON is a good option, JSONb is better, due to speed, and flexibility when it comes to writing and running queries as it supports jsonpath. Check out this thread
Explanation of JSONB introduced by PostgreSQL
You'll get a ton of answers and clarity. I particularly found the answers helpful.

Adebayo A. Daniel
- 121
- 8