1package main
2
3func fetchJSONResponse(url string) interface{} {
4 resp, err := http.Get(url)
5 defer resp.Body.Close()
6 var target interface{}
7 body, _ := ioutil.ReadAll(resp.Body)
8 json.Unmarshal(body, &target)
9 return target
10}
11
12func main() {
13 jsonResp := fetchJSONResponse("http://someurl.com")
14 fmt.Println(jsonResp)
15}