Skip to content

Instantly share code, notes, and snippets.

@jcoyne
Created April 6, 2018 20:38
Show Gist options
  • Save jcoyne/f3bf8d3eef727cf1dda5413eb34298b2 to your computer and use it in GitHub Desktop.
Save jcoyne/f3bf8d3eef727cf1dda5413eb34298b2 to your computer and use it in GitHub Desktop.
Cast version to an integer
// The version is json.Number, but we want it as an integer:
if dataMap["version"] != nil {
i64, err := dataMap["version"].(json.Number).Int64()
if err != nil {
panic(err)
}
dataMap["version"] = int(i64)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment