无法解码JSON响应

I have the following response from a graph api

{
   "data": [
      {
         "name": "Mohamed Galib",
         "id": "502008940"
      },
      {
         "name": "Mebin Joseph",
         "id": "503453614"
      },
      {
         "name": "Rohith Raveendranath",
         "id": "507482441"
      }
   ],
   "paging": {
      "next": "https://some_url"
   }
}

I have a struct as follows

type Item struct {
   Name, Id string
}

I wanted to parse the response and get an array of Item, How do I do that?

You need to update your struct like so:

type Item struct {
   Name string `json:"name"`
   Id string   `json:"id"`
}

and add a struct to represent the wrapper:

type Data struct {
   Data []Item `json:"data"`
}

You can then use json.Unmarshal to populate a Data instance.

See the example in the docs.