package objects import ( "encoding/json" "io/ioutil" ) type Configuration struct { Address string `json:"address"` Debug bool `json:"debug"` } func LoadConfiguration(file string) (Configuration, error) { bytes, err := ioutil.ReadFile(file) if err != nil { return Configuration{}, err } var config Configuration err = json.Unmarshal(bytes, &config) return config, err }