Key adds the given named key to the JSON object. Returns a Value encoder that should be used to encode a JSON value type.
(name string)
| 25 | // Returns a Value encoder that should be used to encode |
| 26 | // a JSON value type. |
| 27 | func (o *Object) Key(name string) Value { |
| 28 | if o.writeComma { |
| 29 | o.w.WriteRune(comma) |
| 30 | } else { |
| 31 | o.writeComma = true |
| 32 | } |
| 33 | o.writeKey(name) |
| 34 | return newValue(o.w, o.scratch) |
| 35 | } |
| 36 | |
| 37 | // Close encodes the end of the JSON Object |
| 38 | func (o *Object) Close() { |