EncodeArray encodes an implementation of MarshalerJSONArray to JSON
(v MarshalerJSONArray)
| 2 | |
| 3 | // EncodeArray encodes an implementation of MarshalerJSONArray to JSON |
| 4 | func (enc *Encoder) EncodeArray(v MarshalerJSONArray) error { |
| 5 | if enc.isPooled == 1 { |
| 6 | panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) |
| 7 | } |
| 8 | _, _ = enc.encodeArray(v) |
| 9 | _, err := enc.Write() |
| 10 | if err != nil { |
| 11 | enc.err = err |
| 12 | return err |
| 13 | } |
| 14 | return nil |
| 15 | } |
| 16 | func (enc *Encoder) encodeArray(v MarshalerJSONArray) ([]byte, error) { |
| 17 | enc.grow(200) |
| 18 | enc.writeByte('[') |