mirror of
https://github.com/HeyPuter/puter-fuse.git
synced 2026-11-13 20:12:49 -10:00
20 lines
374 B
Go
20 lines
374 B
Go
package localutil
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
func ReJSON(obj map[string]interface{}, dest interface{}) error {
|
|
jsonData, err := json.Marshal(obj)
|
|
if err != nil {
|
|
return fmt.Errorf("error marshaling into JSON: %s", err)
|
|
}
|
|
|
|
if err := json.Unmarshal(jsonData, dest); err != nil {
|
|
return fmt.Errorf("error unmarshaling into struct: %s", err)
|
|
}
|
|
|
|
return nil
|
|
}
|