Answer the question
In order to leave comments, you need to log in
How to handle inputs of different types in json?
There are a number of data sources. Each of which "fills" the values of the variables in its own way. I would like to process values in a unified way, but at the same time send back data based on the specifics of the received values.
Those. may come from one source {"some_value": True} and from another {"some_value": "true"}.
In my code, I want to do something like this:
if data.get("some_value"):
return Response({"some_response": <сюда вставлять True или "true", в зависимости от типа some_value>})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question