upda/util/json.go

9 lines
200 B
Go
Raw Normal View History

package util
import "encoding/json"
// UnmarshalGenericJSON unmarshal JSON into given generic type T
func UnmarshalGenericJSON[T any](b []byte) (v T, err error) {
return v, json.Unmarshal(b, &v)
}