spiffe/go-spiffe

Convenience pretty-printing json output

amoore877 opened this issue · 0 comments

referencing Marshal functionality, like in

func (b *Bundle) Marshal() ([]byte, error) {

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()