go json包报错,window没问题,linux上报错。json: unsupported type: map[int]*util.Parameter

type Parameter struct {
    Id                  int
    Protocol            string
    ProxyLevel          int
    ProxyIp             string
    SuperiorProxyIp     string
    Encrypt             int
    EncryptionCondition string
    ProcessId           int
}

//data是map[int]*Parameter类型
dataJson, err := json.Marshal(data)
if err != nil {
    io.WriteString(w, err.Error())
    return
}

共 1 个回复


haha03942008

map转json key只能是string!!!

# 0