2017-05-05 46 views
-3
type A struct { 
    Id uint32 `json:"id"` 
} 

type B struct { 
    A 
    Title   string `json:"title"` 
} 

type C struct { 
    Id    uint32 `json:"id"` 
    Name   string `json:"name"` 
    Arrays   []interface{} `json:"arrays"` 
} 

这是编组接口数组的正确方法吗?Marshaling []中的接口{}

+0

看看struct标签。这就是问题所在 –

回答

1

把数组放在双引号中json:“arrays”