mirror of
https://github.com/number571/go-peer.git
synced 2026-09-14 02:55:43 +05:00
18 lines
274 B
Go
18 lines
274 B
Go
package encoding
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
func SerializeJSON(pData interface{}) []byte {
|
|
res, err := json.Marshal(pData)
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
return res
|
|
}
|
|
|
|
func DeserializeJSON(pData []byte, pRes interface{}) error {
|
|
return json.Unmarshal(pData, pRes)
|
|
}
|