mirror of
https://github.com/mikefarah/yq.git
synced 2025-01-15 04:55:36 +00:00
10 lines
215 B
Markdown
10 lines
215 B
Markdown
|
# 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)
|
||
|
```
|