filosganga/jsonpath

Add union selector

filosganga opened this issue · 0 comments

The union selector (or multi-select list as called by JMESPath) allows to select multiple path and output them in one array.

The draft documents union only in a table:
https://www.ietf.org/archive/id/draft-ietf-jsonpath-base-12.html#tbl-xpath-overview

JMESPath works similarly:
https://jmespath.org/specification.html#multiselect-list

given a json:

{
  "foo": "bar",
  "bar": [0,1,2],
  "baz": "bazinga"
}

Expression

[@.foo, @.bar[0], 'baz', ('baz'), @['baz']]

Result:

["bar", 0, "baz", "baz", "bazinga"]