2018-04-30 18:42:17 +05:00
|
|
|
package json
|
|
|
|
|
2019-03-07 07:56:50 +05:00
|
|
|
type Encoder struct{}
|
|
|
|
|
2018-04-30 18:42:17 +05:00
|
|
|
// AppendKey appends a new key to the output JSON.
|
2019-03-07 07:56:50 +05:00
|
|
|
func (e Encoder) AppendKey(dst []byte, key string) []byte {
|
2018-04-30 18:42:17 +05:00
|
|
|
if len(dst) > 1 && dst[len(dst)-1] != '{' {
|
|
|
|
dst = append(dst, ',')
|
|
|
|
}
|
2019-03-07 07:56:50 +05:00
|
|
|
dst = e.AppendString(dst, key)
|
2018-04-30 18:42:17 +05:00
|
|
|
return append(dst, ':')
|
2019-03-07 07:56:50 +05:00
|
|
|
}
|