matterbridge/vendor/github.com/philippgille/gokv/encoding/json.go
Yousef Mansy c0f5d0c5f7 Add persistent message map
Resolves #541
2023-03-01 01:39:23 -08:00

20 lines
478 B
Go

package encoding
import (
"encoding/json"
)
// JSONcodec encodes/decodes Go values to/from JSON.
// You can use encoding.JSON instead of creating an instance of this struct.
type JSONcodec struct{}
// Marshal encodes a Go value to JSON.
func (c JSONcodec) Marshal(v interface{}) ([]byte, error) {
return json.Marshal(v)
}
// Unmarshal decodes a JSON value into a Go value.
func (c JSONcodec) Unmarshal(data []byte, v interface{}) error {
return json.Unmarshal(data, v)
}