json.go (469B)
1 package bunjson 2 3 import ( 4 "encoding/json" 5 "io" 6 ) 7 8 var _ Provider = (*StdProvider)(nil) 9 10 type StdProvider struct{} 11 12 func (StdProvider) Marshal(v interface{}) ([]byte, error) { 13 return json.Marshal(v) 14 } 15 16 func (StdProvider) Unmarshal(data []byte, v interface{}) error { 17 return json.Unmarshal(data, v) 18 } 19 20 func (StdProvider) NewEncoder(w io.Writer) Encoder { 21 return json.NewEncoder(w) 22 } 23 24 func (StdProvider) NewDecoder(r io.Reader) Decoder { 25 return json.NewDecoder(r) 26 }