diff --git a/secretvalue_funcs.go b/secretvalue_funcs.go index 7571968..c559100 100644 --- a/secretvalue_funcs.go +++ b/secretvalue_funcs.go @@ -1,5 +1,9 @@ package gosecret +import ( + `fmt` +) + /* MarshalJSON converts a SecretValue to a JSON representation. For compat reasons, the MarshalText is left "unmolested" (i.e. renders to a Base64 value). @@ -7,7 +11,7 @@ package gosecret */ func (s *SecretValue) MarshalJSON() (b []byte, err error) { - b = []byte(string(*s)) + b = []byte(fmt.Sprintf("\"%v\"", string(*s))) return } diff --git a/types.go b/types.go index 582b9ef..9cce73d 100644 --- a/types.go +++ b/types.go @@ -169,5 +169,5 @@ type Secret struct { session *Session } -// SecretValue is a custom type that handles JSON encoding/decoding a little more easily. +// SecretValue is a custom type that handles JSON encoding a little more easily. type SecretValue []byte