私は、コードのこの部分を簡素化することができるか知りたいのですが:のような構造体を宣言せずにJSONとしてエンコードされた構造体を送信する方法はありますか?
type PP struct {
Profile_picture string `json:"profile_picture"`
}
json.NewEncoder(w).Encode(PP {result.Profile_picture})
は何か:
json.NewEncoder(w).Encode({result.Profile_picture})
^これは私を与える:syntax error: missing operand
の取り除くために:
をtype PP struct {
Profile_picture string `json:"profile_picture"`
}
ありがとうございました。私の英語のために申し訳ありません。
ありがとうございます!できます ! – Algoru