When unmarshalling a string of json, using Golang's json.Unmarshal() function, I always unmarshal the string into a map[string]interface{} - I'm not sure weather there is a more optimal way of decoding json.
To get to the point:
Sometimes the json's unmarshalled type is nil, not string (or int etc.). This always throws a panic, saying:
interface conversion: interface is nil, not int
How can I avoid this panic or check if the interface's type is nil or not?
Example:
Here is an example of my problem in action: https://play.golang.org/p/0ATzXBbdoS