我不明白错误在哪里,因为在完成结构后,在我看来undefined: Payload
这是一个非常烦人的结构,因为它有足够的结构嵌套和结构切片
你能帮我解决这个问题吗,因为我无法解决它?
https://play.golang.org/p/QewpCfTWY0l
package main
import (
"fmt"
)
type DialogFlowResponseSuggestion struct {
Payload struct {
Google struct {
ExpectUserResponse bool `json:"expectUserResponse"`
RichResponse struct {
Items []struct {
SimpleResponse struct {
TextToSpeech string `json:"textToSpeech"`
} `json:"simpleResponse"`
} `json:"items"`
Suggestions []struct {
Title string `json:"title"`
} `json:"suggestions"`
} `json:"richResponse"`
} `json:"google"`
} `json:"payload"`
}
func main() {
in := DialogFlowResponseSuggestion{
Payload: Payload{
Google: Google{
ExpectUserResponse: true,
RichResponse: RichResponse{
Items: []Items{
Items{SimpleResponse: SimpleResponse{dialog.MReturn.Message}},
},
Suggestions: []Suggestions{
Suggestions{Title: "Suggestion Chips"},
Suggestions{Title: "suggestion 1"},
Suggestions{Title: "suggestion 2"},
},
},
},
},
}
fmt.Println(in)
}
慕娘9325324
相关分类