import encoding/json func test() { m := make(map[string]string) a := `{"xiaoming":"男","xiaohong":"女"}` data ,_ := json.Marshal(a) json.Unmarshal(data,&m)} 以上这段代码是会报错的,cannot unmarshal string into Go value of typ…
Marshal func Marshal(v interface{})([]byte, error) Marshal returns the JSON encoding of v. Marshal返回v的JSON编码. Marshal traverses the value v recursively. If an encountered value implements the Marshaler interface and is not a nil pointer, Marshal call…