jmespath / jmespath/jmespath.site
Support ES6-style compact object literals for multiselect
- Dominant language
- Makefile
- Stars
- 61
- Forks
- 61
- PR merge metrics
- No merged PRs in 30d
Description
Say I have this JSON object and want to pare it down to just the ids and first names:
```json
{
"values": [
{"id": 1, "first": "Bill", "last": "Gates"},
{"id": 2, "first": "Larry", "last": "Page"}
]
}
```
I can do that with this expression: `values[*].{id:id, first:first}`.
Since `{x:x, y:y}` is such a common pattern, ES6 introduced [compact object literal notation][1] to simplify this. In ES6, `{x,y}` is equivalent to `{x:x, y:y}`.
I don't believe `{x,y}` is valid in JMESPath, so it would be a boon (and intuitive to JS users) to add this to the spec.
[1]: http://www.benmvp.com/learning-es6-enhanced-object-literals/
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.