I am trying to pass this into a post from front end but I keep on getting this error on this line and I cannot figure out why is that
{"isUpdated": true}
passing this
in my django, I have these
body_unicode = request.body.decode('utf-8')
data = json.loads(body_unicode)
if data['isUpdated'] is not False:
# more codes
I keep on getting error on this if data['isUpdated'] is not False:
Can someone give me suggestions what is happening?
The string indices must be integers, not str
error means that the data
variable contains a string, and Python is complaining that it cannot use a string to access the characters contained in that string (data[0]
would return the first character, data[1]
would return the second character and so on, but what would data['isUpdated']
return?)
What does the request body contain? Just the text of the post, or a JSON object?