jmespath / jmespath.jep

Proposals for extending the JMESPath Language.
8 stars 5 forks source link

Spec extension - string slice #5

Open glenveegee opened 4 years ago

glenveegee commented 4 years ago

The spec doesn't explicitly exclude strings from being sliced

Index expressions are defined as

index-expression  = expression bracket-specifier / bracket-specifier

and expression includes current node and raw-string as follows

expression        =/ function-expression / pipe-expression / raw-string
expression        =/ current-node

It should be possible then to do the following and not restrict it to JSON array types only

search("FOOBAR", '@[1:3]')
// OUTPUTS: 'OO'