1
0
mirror of https://github.com/taigrr/yq synced 2025-01-18 04:53:17 -08:00

Added from_entries op

This commit is contained in:
Mike Farah
2021-05-09 14:18:25 +10:00
parent 77630ca179
commit 941a453163
5 changed files with 114 additions and 0 deletions

View File

@@ -35,3 +35,37 @@ will output
value: b
```
## from_entries map
Given a sample.yml file of:
```yaml
a: 1
b: 2
```
then
```bash
yq eval 'to_entries | from_entries' sample.yml
```
will output
```yaml
a: 1
b: 2
```
## from_entries with numeric key indexes
from_entries always creates a map, even for numeric keys
Given a sample.yml file of:
```yaml
- a
- b
```
then
```bash
yq eval 'to_entries | from_entries' sample.yml
```
will output
```yaml
0: a
1: b
```