h2non / jsonpath-ng

Finally, a JSONPath implementation for Python that aims to be standard compliant. That's all. Enjoy!
Apache License 2.0
572 stars 85 forks source link

Some operations fail for lists and strings #104

Open sim1234 opened 2 years ago

sim1234 commented 2 years ago

Both parse("c").update(["c"], 2) parse("c").filter(lambda a: True, ["c"])

fail with

TypeError: list indices must be integers or slices, not str

I think it should do nothing instead because that patch does not make sense in context of that data.

Similar case with parse("c").update("c", 2) parse("c").filter(lambda a: True, "c")

but they fail with

TypeError: 'str' object does not support item assignment

and

TypeError: string indices must be integers

respectively.