func main() { a := []byte(`{"Parents": [ "aaaaa","bbbbbbb" ]}`) b := []byte(`{"Parents": [ "Gomez","Moticia" ]}`) var arr []interface{} js,_ := simplejson.NewJson(a) nodes,_ := js.Map() p := nodes["Parents"] d := p.([]interface{}) for _,v := range d { arr = append(arr,v) } js,_ = simplejson.NewJson(b) nodes,_ = js.Map() p = nodes["Parents"] d = p.([]interface{}) for _,v) } res := @H_333_24@make(@H_42_2@map[]interface{}) res["Parents"] = arr c,_ := json.Marshal(res) fmt.Println((C)) }
结果:
{“Parents”:[“aaaaa”,”bbbbbbb”,”Gomez”,”Moticia”]}
相应的,如果数组里面是interface类型同样适用。