Standard library / encoding/json

encoding/json.Delim

Rune-based token type representing one of the JSON delimiters [, ], {, }. Use a type assertion on tokens to distinguish delimiters. Expected stdout: '[ true\n'.

Formal Syntax & Structure

go syntaxgo
type Delim rune

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("[]"))  t, e := d.Token()  must(e)  x, ok := t.(json.Delim)  fmt.Println(x, ok)}
Go Reference