Answer the question
In order to leave comments, you need to log in
How to get JSON from ajax.googleapis.com in Golang style?
Good day
Newbie in GO, I'm trying to do - res, err := http.Get(url), then - ioutil.ReadAll(res.Body), but the emptiness in Response
panic(err) - also falls
where to look? what am I doing wrong?
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
Everything is working
url := "http://ajax.googleapis.com/ajax/services/search/images?v=1.0&imgsz=large&rsz=8&q="
response, err := http.Get(url)
if err != nil {
log.Fatal(err)
}
fmt.Println(response.StatusCode)
defer response.Body.Close()
data, err := ioutil.ReadAll(response.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(string(data))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question