Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "encoding/json"
- "net/http"
- "io/ioutil"
- )
- type data struct {
- Target string `json:"target"`
- Datapoints [][]interface{} `json:"datapoints"`
- }
- func main(){
- stuff := data{}
- info, err := http.Get("URLWITHJSONRESPONSE")
- if err != nil {
- panic(err.Error())
- }
- res, err := ioutil.ReadAll(info.Body)
- if err != nil {
- panic(err.Error())
- }
- json.Unmarshal(res, &stuff)
- fmt.Println(res)
- fmt.Println(stuff.Target)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement