jmespath / jmespath/jmespath.site

Filter hash keys in multiselect

Open
#44 1 comment 15 reactions 0 assignees View on GitHub
Dominant language
Makefile
Stars
61
Forks
61
PR merge metrics
No merged PRs in 30d

Description

Is there a way to remove a single key from a hash, rather than specifying a list of keys to keep?

For example, say I have a GeoJSON FeatureCollection and would like to remove all the `geometry` objects:

```json
{
"type": "FeatureCollection",
"features": [
{
"id": "X",
"type": "Feature",
"properties": {
"name": "Middle of nowhere"
},
"geometry": {
"type": "Point",
"coordinates": [
-102.3046875,
38.272688535980976
]
}
}
]
}
```

I can do that with `features[*].{id:id,type:type,properties:properties}`, but this would also filter out any unexpected keys in the feature.

It would be nice if there were a way to invert a multiselect, e.g. to specifically remove a key from a hash. Maybe something like `features[*].{-geometry}`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.