Golang encoding/json.UnsupportedValueError type and function example

package encoding/json

Golang encoding/json.UnsupportedValueError type and function usage example

 switch err.(type) {
 case *json.UnsupportedValueError:
 fmt.Println("The provided JSON input is invalid")
 fmt.Println("I am unable to utilize value", err.Value, err.Str) // here
 default:
 fmt.Println(err)
 }

Reference :

http://golang.org/pkg/encoding/json/#UnsupportedValueError

Advertisement