Original post

I am trying to dynamically create and invoke a common method after parsing JSON file. The JSON file has an array of “vehicle Types”

{
    "vehicle": [
            "car",
            "truck",

    ]
  }
}

type car struct {}
type truck struck {}

type driveInterface interface {
  drive() 
}

func (car) drive {
    fmt.Println("Driving Car")
}

 

func (truck) drive {
    fmt.Println("Driving truck")
}