Cannot unmarshal string into Go value of type int64
问题 I have struct type tySurvey struct { Id int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` } I do json.Marshal write JSON bytes in HTML page. jQuery modifies name field in object and encodes object using jQueries JSON.stringify and jQuery posts string to Go handler. id field encoded as string. Sent: {"id":1} Received: {"id":"1"} Problem is that json.Unmarshal fails to unmarshal that JSON because id is not integer anymore. json: cannot unmarshal string into Go value of type int64