You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
377 B
Go
21 lines
377 B
Go
package json
|
|
|
|
import (
|
|
"encoding/json"
|
|
"git.noahlan.cn/northlan/nnet/core/serialize"
|
|
)
|
|
|
|
type Serializer struct{}
|
|
|
|
func NewSerializer() serialize.Serializer {
|
|
return &Serializer{}
|
|
}
|
|
|
|
func (s *Serializer) Marshal(i interface{}) ([]byte, error) {
|
|
return json.Marshal(i)
|
|
}
|
|
|
|
func (s *Serializer) Unmarshal(bytes []byte, i interface{}) error {
|
|
return json.Unmarshal(bytes, i)
|
|
}
|