Golang encoding/json.InvalidUTF8Error type and function example
package encoding/json
Golang encoding/json.InvalidUTF8Error type and function usage example
if err != nil {
switch err.(type) {
case *json.SyntaxError, *json.InvalidUTF8Error:
fmt.Printf("invalid json response: %s\n", err)
default:
fmt.Printf("Error: %s\n", err)
}
Reference :
Advertisement
Something interesting
Tutorials
+11.2k Golang : Forwarding a local port to a remote server example
+10.1k Golang : How to use if, eq and print properly in html template
+15.7k Golang : Get own process identifier
+14.1k Golang : Get digits from integer before and after given position example
+5.1k AWS S3 : Prevent Hotlinking policy
+46.3k Golang : How to convert JSON string to map and slice
+5.1k PHP : How to check if an array is empty ?
+14.1k Golang : Get timezone offset from date or timestamp
+16.4k Golang : [json: cannot unmarshal object into Go value of type]
+26.2k Golang : Record voice(audio) from microphone to .WAV file
+7.8k Yum Error: no such table: packages
+4k JQuery : Calling a function inside Jquery(document) block