Golang encoding/json.UnmarshalTypeError type and function example
package encoding/json
An UnmarshalTypeError describes a JSON value that was not appropriate for a value of a specific Go type.
Golang encoding/json.UnmarshalTypeError type and function usage example
switch err.(type) {
case ct.ValidationError:
fmt.Println("Validation error")
case *json.SyntaxError, *json.UnmarshalTypeError:
fmt.Println("The provided JSON input is invalid")
// fmt.Println(err.Error())
default:
fmt.Println(err)
}
Reference :
Advertisement
Something interesting
Tutorials
+9.7k Golang : Create matrix with Gonum Matrix package example
+5.5k Golang : How to solve "too many .rsrc sections" error?
+7.4k Your page has meta tags in the body instead of the head
+20.1k Golang : Get password from console input without echo or masked
+38.1k Golang : Convert to io.ReadSeeker type
+7.6k PHP : How to parse ElasticSearch JSON ?
+19k Android Studio : AlertDialog and EditText to get user string input example
+9.6k Golang : Generate 403 Forbidden to protect a page or prevent indexing by search engine
+5.3k PageSpeed : Clear or flush cache on web server
+7.6k Golang : Add text to image and get OpenCV's X, Y co-ordinates example
+13.4k Golang : Reset buffer example
+4.5k Golang : How to deal with configuration data?