Skip to content

Loss of precision in app_scoped_user_ids caused by json using float64 #19

Closed
@afinkenstadt

Description

When an app_scoped user_id in a post-Facebook graph 2.0 world exceeds 2^53 (9007199254740992), the id values contained in the Result map[string]interface{} begin to lose their bottom-most bits due to mantissa truncation.

The quick solution in result.go is to use

func MakeResult ... {
        dec := json.NewDecoder(bytes.NewReader(jsonBytes))
        dec.UseNumber()
        err = dec.Decode(&res)

        if err != nil {
                err = fmt.Errorf("cannot format facebook response. %v", err)
                return nil, err
        }

rather than using json.Unmarshal(&res)

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions