1/ I wish #golang json serialization marshal/unmarshal an int64 as a string while keeping the int64 representation. Something like,
type User {
UserId int64 `json:"user_id,stringmode"`
}
-
Show this thread
-
2/ I think it's a common use case. Twitter does `id_str` for this reason. And, I got burned for it in
@dgraphlabs' ratel interface not to long ago because I expected the client to do it automatically since it uses json as an exchange format.https://github.com/dgraph-io/ratel/issues/142 …2 replies 0 retweets 0 likesShow this thread -
3/ Whether it's worth the complexity to "encoding/json" is a different matter. My guess is: no. But, I'm not going to try an attempt a patch now because 1) not a priority and 2) no desire to play with
#golang reflection code.1 reply 0 retweets 0 likesShow this thread -
Replying to @generativist
p.s. It sounds like you are just asking for json.Number https://golang.org/pkg/encoding/json/#Number …
1 reply 0 retweets 1 like
hrm. isn't that the opposite? I want int64 in my struct with automatic serialization, not string in my struct with gauranteed int64 representation. ...although, i guess that's the obvious solution for me: just write an int64 with MarshalJSON/UnmarshalJSON.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.