You can use the type json.Number
which is implemented as a string
:
type User struct {
Id json.Number `json:"user_id"`
Username string `json:"user_name"`
}
Then you can simply convert it in any other code:
stringNumber := string(userInstance.Id)
Playground: https://play.golang.org/p/2BTtWKkt8ai