mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-15 15:48:04 +00:00
10 lines
268 B
Markdown
10 lines
268 B
Markdown
# Array to Map
|
|
|
|
Use this operator to convert an array to..a map. The indices are used as map keys, null values in the array are skipped over.
|
|
|
|
Behind the scenes, this is implemented using reduce:
|
|
|
|
```
|
|
(.[] | select(. != null) ) as $i ireduce({}; .[$i | key] = $i)
|
|
```
|