khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame^] | 1 | package json |
2 | |||||
3 | type Encoder struct{} | ||||
4 | |||||
5 | // AppendKey appends a new key to the output JSON. | ||||
6 | func (e Encoder) AppendKey(dst []byte, key string) []byte { | ||||
7 | if len(dst) > 1 && dst[len(dst)-1] != '{' { | ||||
8 | dst = append(dst, ',') | ||||
9 | } | ||||
10 | dst = e.AppendString(dst, key) | ||||
11 | return append(dst, ':') | ||||
12 | } |