mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-01 14:14:52 +08:00
Refactoring Yaml encoder prefs
This commit is contained in:
@@ -36,10 +36,10 @@ will output
|
||||
```yaml
|
||||
a: Easy! as one two three
|
||||
b:
|
||||
c: 2
|
||||
d:
|
||||
- 3
|
||||
- 4
|
||||
c: 2
|
||||
d:
|
||||
- 3
|
||||
- 4
|
||||
```
|
||||
|
||||
## Encode json: simple
|
||||
@@ -244,7 +244,7 @@ will output
|
||||
this: is a multidoc json file
|
||||
---
|
||||
each:
|
||||
- line is a valid json document
|
||||
- line is a valid json document
|
||||
---
|
||||
a number: 4
|
||||
```
|
||||
|
||||
@@ -218,16 +218,16 @@ yq -p=props sample.properties
|
||||
will output
|
||||
```yaml
|
||||
person:
|
||||
# block comments come through
|
||||
# comments on values appear
|
||||
name: Mike Wazowski
|
||||
pets:
|
||||
# comments on array values appear
|
||||
- cat
|
||||
- nested:
|
||||
- list entry
|
||||
food:
|
||||
- pizza
|
||||
# block comments come through
|
||||
# comments on values appear
|
||||
name: Mike Wazowski
|
||||
pets:
|
||||
# comments on array values appear
|
||||
- cat
|
||||
- nested:
|
||||
- list entry
|
||||
food:
|
||||
- pizza
|
||||
```
|
||||
|
||||
## Decode properties - array should be a map
|
||||
@@ -244,7 +244,7 @@ yq -p=props '.things |= array_to_map' sample.properties
|
||||
will output
|
||||
```yaml
|
||||
things:
|
||||
10: mike
|
||||
10: mike
|
||||
```
|
||||
|
||||
## Roundtrip
|
||||
|
||||
Reference in New Issue
Block a user