MarshalJSON implements the json.Marshaler interface.
()
| 149 | |
| 150 | // MarshalJSON implements the json.Marshaler interface. |
| 151 | func (bj BinaryJSON) MarshalJSON() ([]byte, error) { |
| 152 | buf := make([]byte, 0, len(bj.Value)*3/2) |
| 153 | return bj.marshalTo(buf) |
| 154 | } |
| 155 | |
| 156 | func (bj BinaryJSON) marshalTo(buf []byte) ([]byte, error) { |
| 157 | switch bj.TypeCode { |