mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-01 14:14:52 +08:00
Array to map operator for #1415
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# Array to Map
|
||||
|
||||
Use this operator to convert an array to..a map. Skips over null values.
|
||||
|
||||
Behind the scenes, this is implemented using reduce:
|
||||
|
||||
```
|
||||
(.[] | select(. != null) ) as $i ireduce({}; .[$i | key] = $i)
|
||||
```
|
||||
Reference in New Issue
Block a user