Golang encoding/json.MarshalerError type and function example
package encoding/json
Golang encoding/json.MarshalerError type and function usage example
if err != nil {
switch err.(type) {
case *json.MarshalerError:
fmt.Printf("invalid json unmarshal error: %s\n", err.Error())
default:
fmt.Printf("Error: %s\n", err)
}
Reference :
Advertisement
Something interesting
Tutorials
+14.4k Golang : How to filter a map's elements for faster lookup
+6.9k Golang : Fibonacci number generator examples
+22.7k Golang : Round float to precision example
+22.1k Golang : Repeat a character by multiple of x factor
+9.4k Golang : Generate EAN barcode
+29.3k Golang : Save map/struct to JSON or XML file
+13.2k Golang : Skip blank/empty lines in CSV file and trim whitespaces example
+11.6k Golang : Concurrency and goroutine example
+20.3k Golang : Check if os.Stdin input data is piped or from terminal
+9.8k Golang : Format strings to SEO friendly URL example
+6k Golang : Convert Chinese UTF8 characters to Pin Yin
+6.3k Golang : How to get capacity of a slice or array?