On go 1.7, I'm seeing a difference in behavior between json.Unmarshal and 
json.Decoder when it comes to json numbers.

This test program <https://play.golang.org/p/2guVNJLE87> which compares 
json.Unmarshal() vs. json.NewDecoder() behavior w.r.t to numbers works fine 
on go 1.8, but if I run it against go 1.7 on OSX I get this error:

$ go run main.go
2017/07/15 11:19:15 json.Unmarshal() + json.Marshal(): {
    "Doc": {
        "GithubUsers": [
            {
                "id": 3.411441e+06,
                "type": "User"
            }
        ],
        "_id": "github_users_default"
    }
}
2017/07/15 11:19:15 The id field was changed to floating point format
2017/07/15 11:19:15 Couldn't unmarshal into github user object: json: 
cannot unmarshal number 3.411441e+06 into Go value of type int
2017/07/15 11:19:15 json.Decode() + json.Marshal(): {
    "Doc": {
        "GithubUsers": [
            {
                "id": 3411441,
                "type": "User"
            }
        ],
        "_id": "github_users_default"
    }
}


I'm going to update to Go 1.8 and forget about it, but out of curiosity 
does anyone know if it was intentional change in Go 1.8?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to