data := map[string]interface{}{}
jsonStrs := []string{
`{"k1":"v1","k2":"v2"}`,
`{"k3":"v3","k2":2}`,
`{"k4":"v4","k5":"v5"}`,
}
for _, s := range jsonStrs {
json.Unmarshal([]byte(s), &data)
}
for循环结束后data中会包含k1,k2,k3,k4,k5五个元素
data := map[string]interface{}{}
jsonStrs := []string{
`{"k1":"v1","k2":"v2"}`,
`{"k3":"v3","k2":2}`,
`{"k4":"v4","k5":"v5"}`,
}
for _, s := range jsonStrs {
json.Unmarshal([]byte(s), &data)
}
for循环结束后data中会包含k1,k2,k3,k4,k5五个元素