[Fixed]-Django JSON Eroor: "list indices must be integers, not str"

1👍

First of all here I guess all_emp['data'].['users'] must be all_emp['data']['users'] and d["employeeId"] == person for d in all_emp['data']['users'] here d is a list with only one element and that element then have all employer data.

So as a quick fix you can try this:

d["employeeId"] == person for d in all_emp['data']['users'][0]

👤sehrob

0👍

I resolve my issue with following code.

p_result = []
for person in people_like:                
    for d in all_emp['data']['users'][0]:
       if str(person) in d["employeeId"]:
           person = d["firstName"] + ' '+ d["lastName"]
           p_result.append(person)

i.likelist = p_result
👤Shri

Leave a comment