Skip to content

Access parent or root data in nested expression #86

@Stadly

Description

@Stadly

For example, how can I extract all the people having age larger than minAge?

{
  "minAge": 20,
  "people": [
    {
      "age": 20,
      "other": "foo",
      "name": "Bob"
    },
    {
      "age": 25,
      "other": "bar",
      "name": "Fred"
    },
    {
      "age": 30,
      "other": "baz",
      "name": "George"
    }
  ]
}

I'm imagining something like this:

  • people[?age > {minAge}], where {...} is an expression that is evaluated using the full JSON document as data, instead of the current node.
  • people[?age > @..minAge], where @.. refers to data one level above the current node. @... would refer to data two levels above the current node, etc.
  • people[?age > $.minAge], where $ refers to the root data, just like @ refers to the data of the current node.

Is something like this possible, or are there other ways to achieve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions