Rename your "slug string" to "Slug string" to make it public so the json 
package can write to it, and make the "Members" field of data a slice:
type Member struct {
    Slug string
}
type data struct {
    Members []Member
}

On Tuesday, October 9, 2018 at 2:46:02 PM UTC+2, pdbw...@gmail.com wrote:
>
>
> type Members struct {
>     slug string `json:"slug"`
> }
> type data struct {
>     Members Members //`json:"members"`
> }
>
> func main() {
>
>     resp, err := http.Get("
> https://gist.githubusercontent.com/DQIJAO/e14c64ea610688e70228a9fb8c649b2c/raw/6cccd444c1ef65411aa3662b112634996b837414/bnk48.json
> ")
>
>     defer resp.Body.Close()
>
>     buf := new(bytes.Buffer)
>     buf.ReadFrom(resp.Body)
>     respByte := buf.Bytes()
>     var data data
>
>     err = json.Unmarshal(respByte, &data)
>
>     if err != nil {
>         fmt.Println(err)
>
>         return
>     }
>
>     log.Println(data)
>
> }
>

-- 
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.

Reply via email to