2017-05-05 16 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」