• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

253
Views
string indices must be integers, not str - django

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?

about 3 years ago · Santiago Trujillo
1 answers
Answer question

0

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?

about 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error