mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-21 17:21:09 +01:00
13 lines
197 B
Go
13 lines
197 B
Go
package utils
|
|
|
|
import "encoding/json"
|
|
|
|
func JsonToBytes(d interface{}) (bytes []byte, err error) {
|
|
switch d.(type) {
|
|
case []byte:
|
|
return d.([]byte), nil
|
|
default:
|
|
return json.Marshal(d)
|
|
}
|
|
}
|