[Fixed]-Extracting a nested list with Django and replacing values

1👍

Ok, try using the following

# result = <api call>
for i in result["artists"]["items"]:
    if "images" in i and i["images"]:
        i["images"] = [i["images"][0]]

print result

See if this works.

👤NS0

Leave a comment