15 lines
254 B
Go
15 lines
254 B
Go
package common
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
)
|
|
|
|
func DecodeJson(data []byte, v any) error {
|
|
return json.NewDecoder(bytes.NewReader(data)).Decode(v)
|
|
}
|
|
|
|
func DecodeJsonStr(data string, v any) error {
|
|
return DecodeJson(StringToByteSlice(data), v)
|
|
}
|