Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access parent or root data in nested expression #86

Open
Stadly opened this issue Oct 28, 2024 · 0 comments
Open

Access parent or root data in nested expression #86

Stadly opened this issue Oct 28, 2024 · 0 comments

Comments

@Stadly
Copy link

Stadly commented Oct 28, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant