github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/kbfs/libfs/json.go (about) 1 // Copyright 2016 Keybase Inc. All rights reserved. 2 // Use of this source code is governed by a BSD 3 // license that can be found in the LICENSE file. 4 5 package libfs 6 7 import ( 8 "encoding/json" 9 ) 10 11 // PrettyJSON marshals a value to human-readable JSON. 12 func PrettyJSON(value interface{}) ([]byte, error) { 13 data, err := json.MarshalIndent(value, "", " ") 14 if err != nil { 15 return nil, err 16 } 17 data = append(data, '\n') 18 return data, nil 19 }