Golang encoding/json.UnsupportedTypeError type and function example
package encoding/json
An UnsupportedTypeError is returned by Marshal when attempting to encode an unsupported value type.
Golang encoding/json.UnsupportedTypeError type and function usage example
switch err.(type) {
case *json.UnsupportedTypeError:
fmt.Println("The provided JSON input is invalid")
// fmt.Println(err.Error())
default:
fmt.Println(err)
}
Reference :
Advertisement
Something interesting
Tutorials
+5.1k Linux : How to set root password in Linux Mint
+17.1k Golang : Capture stdout of a child process and act according to the result
+7k Golang : Levenshtein distance example
+7.8k Golang : Example of how to detect which type of script a word belongs to
+14.9k Golang : How to check for empty array string or string?
+6.1k Golang : Create new color from command line parameters
+14.2k Golang : syscall.Socket example
+13.8k Golang : Gin framework accept query string by post request example
+8.8k Golang : Heap sort example
+12.3k Golang : 2 dimensional array example
+7.7k Golang : How to execute code at certain day, hour and minute?
+15.6k Chrome : ERR_INSECURE_RESPONSE and allow Chrome browser to load insecure content