Q:

golang big numbers to readable/ string formats

I have a json response from an API that look like this after I use json. Unmarshal then save it to an interface variable.
 map[message_num:3 
 task_num:0 
 name: test_room 
 type:my role:member sticky:true unread_num:0 
 room_id:3.190762e+06 ]

I want to get the room_id, but its not readable 
 3.190762e+06

I want to format this to a string, so I can use it to send a post request.

A:

You could extract room_id from your JSON as a string "3.190762e+06".
Then you can:

convert it to a (readable) float, with strconv.ParseFloat(), 
and convert it back to a string, with fmt.Sprintf().

See this example:
i, err := strconv.ParseFloat("3.190762e+06", 64)
if err == nil {
    s := fmt.Sprintf("%.0f\n", i)
    fmt.Println(s)
} 

Output:
3190762

