Standard library / encoding/json

encoding/json.Token

Defined interface type (declared as any) for a decoded token. Values include bool, string, float64 or Number, Delim and nil. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
type Token any

Working Example

Example Snippetgo
package main
import (  "encoding/json"  "fmt"  "strings")
func must(e error) {  if e != nil {    panic(e)  }}
func main() {  d := json.NewDecoder(strings.NewReader("null"))  var t json.Token  var e error  t, e = d.Token()  must(e)  fmt.Println(t == nil)}
Go Reference