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
+41k Golang : Convert to io.ReadSeeker type
+5.5k Golang : Customize scanner.Scanner to treat dash as part of identifier
+25.4k Golang : Create PDF file from HTML file
+9.8k Golang : Accessing content anonymously with Tor
+5k Golang : How to pass data between controllers with JSON Web Token
+14k Golang : Check if an integer is negative or positive
+14.7k Golang : Find network of an IP address
+5k Facebook : How to place save to Facebook button on your website
+12.7k Golang : Flush and close file created by os.Create and bufio.NewWriter example
+26k Golang : convert rune to integer value
+9.3k Golang : Get curl -I or head data from URL example