mirror of
https://github.com/rancher/norman.git
synced 2025-09-18 08:14:56 +00:00
If map, don't encode
This commit is contained in:
@@ -198,6 +198,10 @@ func ToObj(data interface{}, into interface{}) error {
|
||||
}
|
||||
|
||||
func EncodeToMap(obj interface{}) (map[string]interface{}, error) {
|
||||
if m, ok := obj.(map[string]interface{}); ok {
|
||||
return m, nil
|
||||
}
|
||||
|
||||
b, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user