| 1 | package gojsonq |
| 2 | |
| 3 | import "encoding/json" |
| 4 | |
| 5 | // Decoder provide contract to decode JSON using custom decoder |
| 6 | type Decoder interface { |
| 7 | Decode(data []byte, v interface{}) error |
| 8 | } |
| 9 | |
| 10 | // DefaultDecoder use json.Unmarshal to decode JSON |
| 11 | type DefaultDecoder struct{} |
| 12 | |
| 13 | // Decode decodes using json.Unmarshal |
| 14 | func (u *DefaultDecoder) Decode(data []byte, v interface{}) error { |
| 15 | return json.Unmarshal(data, v) |
| 16 | } |