On Wed, 12 Dec 2018, at 6:03 AM, olivier.gale...@gmail.com wrote: > Hello, > > I trie to get value from api request > i have this response > [{"id": > 62,"nom":"TEST","URI":"http://192.168.0.31/param/","IP":"192.168.0.31","MacAdress":"DE:AD:BE:EF:FE:ED","created_at":"2018- > 12-06T20:44:57.131380+01:00","update_at":"2018-12- > 06T21:00:40.847034+01:00","Localisation":2,"Type":1}] > > i would get the value from nom and IP for example. > > i do a http.get to get the body response, but I can not recover the values. > > my sample code: > > > resp, > err:=http.Get("http://192.168.0.28:8000/api/filter/192.168.0.31/") > if nil !=err { > fmt.Printf("%s", err) > log.Fatalln(err) > } else { > defer resp.Body.Close() > contents, err := > ioutil.ReadAll(resp.Body) > if nil !=err { > fmt.Printf("%s", err) > log.Fatalln(err) > } > fmt.Printf("%s\n", string(contents)) > > > > Can you help me ? >
What is printed when you run your code? -- 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 golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.