mirror of
https://github.com/asdine/storm.git
synced 2025-10-05 14:56:58 +08:00
20 lines
397 B
Go
20 lines
397 B
Go
// Package json contains a codec to encode and decode entities in JSON format
|
|
package json
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
// Codec that encodes to and decodes from JSON.
|
|
var Codec = new(jsonCodec)
|
|
|
|
type jsonCodec int
|
|
|
|
func (j jsonCodec) Marshal(v interface{}) ([]byte, error) {
|
|
return json.Marshal(v)
|
|
}
|
|
|
|
func (j jsonCodec) Unmarshal(b []byte, v interface{}) error {
|
|
return json.Unmarshal(b, v)
|
|
}
|