jmespath / jmespath/jmespath.site
Should it be explained more thoroughly that a a function returns a projection?
- Dominant language
- Makefile
- Stars
- 61
- Forks
- 61
- PR merge metrics
- No merged PRs in 30d
Description
Let's say we have a list of list and want to select the sublist where a string starts with a letter.
So, given the JSON
```json
[
[
"ab",
"cd"
],
[
"ef",
"gh"
]
]
```
One could do:
```none
[?contains([].starts_with(@, `a`), `true`)]
```
But, in order to have a consistent notation, I was trying to make the `contains` function a dot notation too, so:
```none
[?[].starts_with(@, `a`).contains(@, `true`)]
```
which does not work.
I figured out it as because `starts_with` returns a projection, so it can be achieved resetting it:
```none
[?[].starts_with(@, `a`) | contains(@, `true`)]
```
But I feel, for a new comer that does not know that well about projections and resetting them, it should be explained in the specification in more details, shouldn't it?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.