`$[0,-1:].name` returns the whole list
using the path $[0,-1:].name on
[
{ "name": "name1" },
{ "name": "name2" },
{ "name": "name3" },
{ "name": "name4" },
]
returns the 4 names.
Compared with an online evaluator which validates this syntax
In this case we match the evaluator at https://jsonpath.curiousconcept.com/ where the first index is used, and any other indexes are ignored, and then the colon is interpreted as a range extending to the end of the array.
I'm not sure how we should actually handle it (either make it an error or ignore the trailing colon) because I don't think the existing behavior is the most intuitive. I need to think more on that.
@tlevavasseur-decathlon what would you expect that path to do?
Hi, I was expecting an array of $[0].name and $[-1:].name (which works with your lib) but I can do with this syntax $[0,-1].name (I hadn't tried this one until now). Thanks
I'll update the library to reflect that, thanks for the report.
The result is the first and the last in spec 0.8.3