mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-04 00:14:55 +08:00
Pretty print json
This commit is contained in:
@@ -29,8 +29,11 @@ type jsonEncoder struct {
|
||||
encoder *json.Encoder
|
||||
}
|
||||
|
||||
func NewJsonEncoder(destination io.Writer) Encoder {
|
||||
func NewJsonEncoder(destination io.Writer, prettyPrint bool) Encoder {
|
||||
var encoder = json.NewEncoder(destination)
|
||||
if prettyPrint {
|
||||
encoder.SetIndent("", " ")
|
||||
}
|
||||
return &jsonEncoder{encoder}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user