2022-08-15 04:51:07 +00:00
|
|
|
package pjson
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
2022-12-01 04:18:07 +00:00
|
|
|
"log"
|
2022-08-15 04:51:07 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// ToBytes ...
|
|
|
|
func ToBytes(data interface{}) []byte {
|
|
|
|
b, err := json.Marshal(data)
|
|
|
|
if err != nil {
|
2022-12-01 04:18:07 +00:00
|
|
|
log.Printf("3pl/util/pjson.ToBytes.Marshal: %v\n", err)
|
2022-08-15 04:51:07 +00:00
|
|
|
}
|
|
|
|
return b
|
|
|
|
}
|