How to deal with json response in django from external API

I am currently building a simple dashboard in Django using data from external API like Amazon SP-API. My main question is how do you keep data in models as all the response are in JSON format. Do you store them as JSON Field or serialize all fields into separate columns in SQL Database? I am iterating over 100 accounts using different refresh tokens.

Currently created model with separate columns but some of JSON's are nested multiple times and processing and saving them to database is cpu consuming.

Most probably responses from external APIs data is included in body of the response. So

body = request.body.decode("utf-8")

Now it will be in string format and you have to convert it into usable format, so,

import json
body = json.loads(body_unicode)

Now it will be in dict or 'list' type. And now you can use it easily.

Back to Top