Convenience pretty-printing json output
amoore877 opened this issue · 0 comments
amoore877 commented
referencing Marshal
functionality, like in
go-spiffe/v2/bundle/spiffebundle/bundle.go
Line 339 in e1b8af8
It would be a nice convenience if there we an option to get the json output in format like:
{
"keys": [
{
"use": "x509-svid",
"kty": "EC",
"crv": "P-256",
"x": "some_x",
"y": "some_y",
"x5c": [
"a_cert"
]
}
]
}
instead of the current result of
{"keys": [ {"use": "x509-svid","kty": "EC","crv": "P-256",...}
Not a critical issue, since consumers just have to use something like:
import "encoding/json"
...
var prettyJSON bytes.Buffer
if err := json.Indent(&prettyJSON, currentMarshalBytesOutput, "", " "); err != nil {
return err
}
prettyBundleBytes := prettyJSON.Bytes()