package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
)
type coinsData struct {
Name string `json:"name"`
Photo string `json:"photo"`
}
func main() {
resp, err := http.Get("http://uinames.com/api/?ext&amount=25")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
var c []coinsData
err = json.Unmarshal(body, &c)
if err != nil {
log.Fatal(err)
}
log.Println(c.Name[0])
//fmt.Printf("%v\n", c)
}
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.