我是GOlang Iam的新手,在阅读json数组时遇到一个问题。需要以下查询的帮助。

要求Json:

{ "httpReq": {
"username": "1234567890",
"password": "1234567890",
"number": "123456"
}
}

回应Json:

{ "httpResp": {
    "status": "Pass",
    "message": "great"
    }
    }

下面是我的代码:如果我在其工作下面传递json对象,但是我需要在json中发送“ httpReq”。

package main

import (
    "encoding/json"
    "fmt"
)


type people struct {
    Username string `json:"username"`
    Password string `json:"password"`
    Number string `json:"number"`

}

type peopleread struct {
    Collection []people
}

func main() {
    text := `{
    "username": "1234567890",
    "password": "1234567890",
    "number": "123456"

}`
    textBytes := []byte(text)

    //people1 := people{}
    var people2 people
    err := json.Unmarshal(textBytes, &people2)
    if err != nil {
        fmt.Println(err)
        return
    }
    Username := people2.Username
    Password := people2.Password
    Number := people2.Number
        fmt.Println(Username)
        fmt.Println(Password)
        fmt.Println(Number) 
}