Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type State struct{
- round []int
- p1val []int
- p2val []int
- decided []int
- decision []bool
- }
- func readJson(filename string) {
- var (
- idState map[string]interface{}
- )
- jsonFile, err := os.Open(filename)
- if err != nil {
- fmt.Print(err)
- }
- fmt.Println("Opened up the file")
- bytes, _ := ioutil.ReadAll(jsonFile)
- json.Unmarshal([]byte(bytes), &idState)
- for key, value := range idState{
- fmt.Println(key, value)
- break
- }
- var states State
- for _, value := range idState{
- err = mapstructure.Decode(value, states)
- break
- }
- fmt.Printf("%#v", states)
- }
Add Comment
Please, Sign In to add comment