Array to map operator for #1415

This commit is contained in:
Mike Farah
2022-11-08 13:40:00 +11:00
parent c915113120
commit bd5e5dc965
8 changed files with 113 additions and 0 deletions
+17
View File
@@ -149,6 +149,23 @@ person:
- pizza
```
## Decode properties - array should be a map
If you have a numeric map key in your property files, use array_to_map to convert them to maps.
Given a sample.properties file of:
```properties
things.10 = mike
```
then
```bash
yq -p=props '.things |= array_to_map' sample.properties
```
will output
```yaml
things:
10: mike
```
## Roundtrip
Given a sample.properties file of:
```properties