К примеру такpackage main
import "encoding/json"
import "fmt"
type Users struct {
Users []User `json:"response"`
}
type User struct {
ID int64 `json:"id,omitempty"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Photo100 string `json:"photo_100"`
}
type Response struct {
LengthValue Length `json:"response"`
}
type Length struct {
Count int64 `json:"count"`
Items []int64 `json:"items"`
}
func main() {
byt := []byte(`{
"response": [{
"id": 1,
"first_name": "Pavel",
"last_name": "Durov",
"photo_100": "https://pp.vk.me/...542/fcMCbfjDsv0.jpg"
}, {
"id": 2,
"first_name": "Alexandra",
"last_name": "Vladimirova",
"photo_100": "https://pp.vk.me/...846/sc1FPdEM41s.jpg"
}]
}`)
var usr Users
if err := json.Unmarshal(byt, &usr); err != nil {
panic(err)
}
byt = []byte(`{
"response": {
"count": 724,
"items": [3841194, 46]
}
}`)
var res Response
if err := json.Unmarshal(byt, &res); err != nil {
panic(err)
}
fmt.Println(usr, res)
}