When you try to parse a 64-bit integer in JavaScript (parseInt("5838406743490560")
) it works on the localhost server but not on the Appspot.com server. On the appspot.com server you need to parse it as a string instead of a int64
. Does anyone know why that is?
On localhost I can do this:
type Entity struct {
List []*Message `json:"list"`
}
type Message struct {
Id int64 `json:"id" datastore:"-"`
}
After uploading it to appspot.com, I need to parse it as a string or I get the error message below.
type Entity struct {
List []*Message `json:"list"`
}
type Message struct {
Id int64 `json:"id,string" datastore:"-"`
}
Package that gets sent where id=parseInt("5838406743490560")
:
[{"jsonrpc":"2.0","id":"gapiRpc","method":"service.datastore.delete","apiVersion":"v0","params":{"list":[{"id":5838406743490560}]}}]
On Appspot.com I can not unmarshal using
json:"id" datastore:"-"
.On localhost it works perfect.
Error on Appspot.com only:
[
{
"error": {
"code": 400,
"message": "json: cannot unmarshal string into Go value of type int64",
"data": [
{
"domain": "global",
"reason": "badRequest",
"message": "json: cannot unmarshal string into Go value of type int64"
}
]
},
"id": "gapiRpc"
}
]
I am using SDK v1.9.6.