使用golang返回一个空数组,而不是null,使用gin返回gin

So i have a struct :

type ProductConstructed struct {
    Name string `json:"Name"`
    BrandMedals []string `json:"BRAND_MEDALS"`
}

When i return my object with gin and :

func  contructproduct(c *gin.Context) {
    var response ProductConstructed 
    response.Name = "toto"

    c.JSON(200, response)
}

func main() {
    var err error
    if err != nil {
        panic(err)
    }
    //gin.SetMode(gin.ReleaseMode)
    r := gin.Default()
    r.POST("/constructProductGo/v1/constructProduct", contructproduct)
    r.Run(":8200") // listen and serve on 0.0.0.0:8080
}

It returns me :

null

instead of

[]

How to return an empty array ?

Regards

So the solution was to initialize it with :

productConstructed.BrandMedals = make([]string, 0)