mirror of
https://github.com/taigrr/yq
synced 2025-01-18 04:53:17 -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