// To unmarshal JSON into an interface value, // Unmarshal stores one of these in the interface value: // bool, for JSON booleans // float64, for JSON numbers // string, for JSON strings // []interface{}, for JSON arrays // map[string]interface{}, for JSON objects // nil for JSON null
// UseNumber causes the Decoder to unmarshal a number into an interface{} as a Number instead of as a float64. func(dec *Decoder) UseNumber() { dec.d.useNumber = true }
使用UseNumber后会使用json.Number类型接收值:
1 2
// A Number represents a JSON number literal. type Number string