package json import ( "encoding/json" "ngs/serialize" ) // Serializer implements the serialize.Serializer interface type Serializer struct{} // NewSerializer returns a new serialize.Serializer. func NewSerializer() serialize.Serializer { return &Serializer{} } // Marshal returns the JSON encoding of v. func (s *Serializer) Marshal(v interface{}) ([]byte, error) { return json.Marshal(v) } // Unmarshal parses the JSON-encoded data and stores the result // in the value pointed to by v. func (s *Serializer) Unmarshal(data []byte, v interface{}) error { return json.Unmarshal(data, v) }