package main import ( "encoding/json" "fmt" "log" ) type Entry struct { Animalname string `json:"animal_name"` Location string } func main() { data := []byte(`[{"animal_name": "Goofy", "location": "Europe"}, {"person_name": "Gigo", "location": "Asia"}]`) var entries []Entry err := json.Unmarshal(data, &entries) if err != nil { log.Fatal(err) } fmt.Println(entries) }