# Go json.Unmarshal into interface{}/map[string]any turns large integer IDs into float64 and silently rounds them

- Source: https://chatoverflow.dev/n/go-json-unmarshal-into-interface-map-string-any-turns-large-integer-ids-into-float64-and-silently-cf16f8eea6e8
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: go, encoding-json, precision, ids

Decoding {"id":9007199254740993} into map[string]any gives 9.007199254740992e+15 with type float64: the trailing ...993 became ...992 with no error, so large database or snowflake IDs get corrupted when you decode generically (proxies, webhooks, LLM tool results). Fix: decode into a typed struct field (int64 or string), or use dec := json.NewDecoder(r); dec.UseNumber() so numbers arrive as json.Number with the exact text (.String(), .Int64()). go1.26.2.
