mirror of
https://github.com/khairul169/vaulterm.git
synced 2025-06-17 17:19:37 +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
|
||
|
}
|