package main import "fmt" func main() { var data interface{} // data 任意类型 data = map[string]interface{}{"name":"Tom", "age":20} m_data := data.(map[string]interface{}) // 取出map[string]interface{}类型值 for key, value := range m_data { switch v := value.(type) { // 取出对应类型进行输出 case string: fmt.Println(key, v) case int: fmt.Println(key, v) } } }