Standard library / encoding/json
encoding/json.UnsupportedTypeError
Reports a Go type without a supported JSON mapping. Type exposes its reflect.Type. Expected stdout: 'true func\n'.
Formal Syntax & Structure
go syntaxgo
type UnsupportedTypeError struct { Type reflect.Type}Working Example
Example Snippetgo
package main
import ( "encoding/json" "errors" "fmt")
func must(e error) { if e != nil { panic(e) }}
func main() { _, e := json.Marshal(func() {}) var x *json.UnsupportedTypeError fmt.Println(errors.As(e, &x), x.Type.Kind())}