You can manage this by deserializing known data structures into actual structs:
package main
import (
"fmt"
"json"
)
type Data struct {
i int
f float
}
var j = `{"i": 1, "f": 2.5}`
func main() {
d := new(Data)
json.Unmarshal(j, d)
fmt.Println(d)
}
In this example, d.i and d.f will be of the correct types. Otherwise
json just guesses. (Although guessing float64 for "1" is not great.)
Andrew