tbotd/vendor/src/github.com/asdine/storm/codec/json/json.go

19 lines
315 B
Go

package json
import (
"encoding/json"
)
// Codec that encodes to and decodes from JSON.
var Codec = new(jsonCodec)
type jsonCodec int
func (j jsonCodec) Encode(v interface{}) ([]byte, error) {
return json.Marshal(v)
}
func (j jsonCodec) Decode(b []byte, v interface{}) error {
return json.Unmarshal(b, v)
}