-
Notifications
You must be signed in to change notification settings - Fork 146
Open
Description
Hi
I need to parse *fastjson.Value value to a string, in case of Number type is there an elegant and fast way check if the value is int number or float number?
func parseFastJsonVal(v *fastjson.Value) string {
switch v.Type() {
...
case fastjson.TypeNumber:
// if it's int number i want to return fmt.Sprintf("%d", v.GetInt())
// if it's float i want to return fmt.Sprintf("%v", v.GetFloat64())
}
return ""
}
I can do naive stuff like checking explicitly if it's float or if it has a decimal point, but i wonder if there is a fastest way to check it based on the data i already got from parsing the JSON
Metadata
Metadata
Assignees
Labels
No labels