TypeError:在Python中过滤JSON中的值时,字符串索引必须为整数

x = { "people": [{ "owner": "bob", "petname": "fido", "species": "dog", "size": "chunky"}, {"owner": "mary","petname": "marvin","species": "cat","size": "cat"}]}
    y = json.dumps(x)
    z = json.loads(y)
    for i in z:
        if i["owner"] == "bob":
            print(i['petname'])
            break

该代码的目标是通过为所有者命名为“ bob”来返回“ fido”

但是我得到的只是TypeError:字符串索引必须是整数。我究竟做错了什么?谢谢