Answer the question
In order to leave comments, you need to log in
How to find out what is in json and how to parse it and save only the necessary information?
Good morning. I'm stuck on this, let's say I send information to the rest api, not even from the front, but for example, there is a request from another site in general, and there is a lot of information in this request, how can I check what kind of information is there and how to save only what is necessary to the database ? If everything is clear with the front, I'm waiting for a login and password, then I have a model with a login and password and serialization for this, then I need help here. I don’t know how to check the data in the request and how to parse it, but I won’t need to write to describe the model for all this huge data array? I only need 2-3 fields. Thank you in advance.
Answer the question
In order to leave comments, you need to log in
Parse json from string - json.loads. How to work with it further, you need to learn the basics of python, or rather, work with list and dict data structures,
Use standard Python tools like the json library
Here is a good article on how to deal with json.
The scheme of work is as follows. You get a server response or whatever you have there. You turn it into a python object and do all the necessary manipulations.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question