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

Support ES6-style compact object literals for multiselect #43

Open
danvk opened this issue Feb 18, 2018 · 0 comments
Open

Support ES6-style compact object literals for multiselect #43

danvk opened this issue Feb 18, 2018 · 0 comments

Comments

@danvk
Copy link

danvk commented Feb 18, 2018

Say I have this JSON object and want to pare it down to just the ids and first names:

{
  "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 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.

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