Implied is that index expressions are for arrays only.
We originally thought it would be useful to allow:
expressions to compute the index offset
Allow strings as indexes to objects. e.g. foo["bar"] would be the same as foo.bar
Allow expressions to compute the slice parameters
In hindsight, none of these are particularly useful, and we are better off simplifying the grammar by removing them.
Bracketed expressions are not useful because the expression gets evaluated in the context of the parent. e.g. given: people[expression] the context for the expression is the contents of people -- which is unlikely to have data to help calculate an index
We have the value() function that indexes both arrays and objects, and allows computing offsets/keys and does not have the same context limitations.
We have the mid() function that is very similar to slice and allows expressions for its parameters
The original JMESPath implementation allows:
Implied is that index expressions are for arrays only. We originally thought it would be useful to allow:
foo["bar"]
would be the same asfoo.bar
In hindsight, none of these are particularly useful, and we are better off simplifying the grammar by removing them.
people[expression]
the context for the expression is the contents ofpeople
-- which is unlikely to have data to help calculate an indexvalue()
function that indexes both arrays and objects, and allows computing offsets/keys and does not have the same context limitations.mid()
function that is very similar to slice and allows expressions for its parameters