mirror of
https://github.com/khairul169/vaulterm.git
synced 2025-04-28 16:49:39 +07:00
16 lines
300 B
Go
16 lines
300 B
Go
package utils
|
|
|
|
import "encoding/json"
|
|
|
|
func ParseMapInterface(data interface{}, out interface{}) error {
|
|
// Marshal the map to JSON
|
|
jsonData, err := json.Marshal(data)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// Unmarshal the JSON data into the struct
|
|
err = json.Unmarshal(jsonData, &out)
|
|
return err
|
|
}
|