JSONPath-Plus / JSONPath

A fork of JSONPath from http://goessner.net/articles/JsonPath/
Other
958 stars 169 forks source link

Slice Selector for reversing the Output #176

Open MarkusMas opened 2 years ago

MarkusMas commented 2 years ago

Many JsonPath methods like dchester and goessner feature reversing the output with the slice selector. For example:

Example | Description -- | -- $[-1] | Last item $[-2:] | Last two items $[:-2] | All items except the last two $[::-1] | All items, reversed $[1::-1] | First two items, reversed $[:-3:-1] | Last two items, reversed $[-3::-1] | All items except the last two, reversed

Source: https://danielaparker.github.io/JsonCons.Net/articles/JsonPath/JsonConsJsonPath.html

The slicing works great with JSONPath-Plus however reversing (with -1 at the end) seems to be unavailable.

Is it possible to add this feature. Or is there any othe workaroud. Maybe a different expression that is not documented?