initial commit
This commit is contained in:
11
json_ex/json.go
Normal file
11
json_ex/json.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package json_ex
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
func GenericUnmarshal[T any](source []byte) (T, error) {
|
||||
var target T
|
||||
if err := json.Unmarshal(source, &target); err != nil {
|
||||
return target, err
|
||||
}
|
||||
return target, nil
|
||||
}
|
||||
Reference in New Issue
Block a user