type Decoder … // NewDecoder returns a new decoder that reads from r. // // The decoder introduces its own buffering and may // read data from r beyond the JSON values requested. func NewDecoder(r io.Reader) *Decoder { … } // UseNumber causes the Decoder to unmarshal a number into an interface{} as a // [Number] instead of as a float64. func (dec *Decoder) UseNumber() { … } // DisallowUnknownFields causes the Decoder to return an error when the destination // is a struct and the input contains object keys which do not match any // non-ignored, exported fields in the destination. func (dec *Decoder) DisallowUnknownFields() { … } // Decode reads the next JSON-encoded value from its // input and stores it in the value pointed to by v. // // See the documentation for [Unmarshal] for details about // the conversion of JSON into a Go value. func (dec *Decoder) Decode(v any) error { … } // Buffered returns a reader of the data remaining in the Decoder's // buffer. The reader is valid until the next call to [Decoder.Decode]. func (dec *Decoder) Buffered() io.Reader { … } // readValue reads a JSON value into dec.buf. // It returns the length of the encoding. func (dec *Decoder) readValue() (int, error) { … } func (dec *Decoder) refill() error { … } func nonSpace(b []byte) bool { … } type Encoder … // NewEncoder returns a new encoder that writes to w. func NewEncoder(w io.Writer) *Encoder { … } // Encode writes the JSON encoding of v to the stream, // with insignificant space characters elided, // followed by a newline character. // // See the documentation for [Marshal] for details about the // conversion of Go values to JSON. func (enc *Encoder) Encode(v any) error { … } // SetIndent instructs the encoder to format each subsequent encoded // value as if indented by the package-level function Indent(dst, src, prefix, indent). // Calling SetIndent("", "") disables indentation. func (enc *Encoder) SetIndent(prefix, indent string) { … } // SetEscapeHTML specifies whether problematic HTML characters // should be escaped inside JSON quoted strings. // The default behavior is to escape &, <, and > to \u0026, \u003c, and \u003e // to avoid certain safety problems that can arise when embedding JSON in HTML. // // In non-HTML settings where the escaping interferes with the readability // of the output, SetEscapeHTML(false) disables this behavior. func (enc *Encoder) SetEscapeHTML(on bool) { … } var _ … var _ … const tokenTopValue … const tokenArrayStart … const tokenArrayValue … const tokenArrayComma … const tokenObjectStart … const tokenObjectKey … const tokenObjectColon … const tokenObjectValue … const tokenObjectComma … // advance tokenstate from a separator state to a value state func (dec *Decoder) tokenPrepareForDecode() error { … } func (dec *Decoder) tokenValueAllowed() bool { … } func (dec *Decoder) tokenValueEnd() { … } // Token returns the next JSON token in the input stream. // At the end of the input stream, Token returns nil, [io.EOF]. // // Token guarantees that the delimiters [ ] { } it returns are // properly nested and matched: if Token encounters an unexpected // delimiter in the input, it will return an error. // // The input stream consists of basic JSON values—bool, string, // number, and null—along with delimiters [ ] { } of type [Delim] // to mark the start and end of arrays and objects. // Commas and colons are elided. func (dec *Decoder) Token() (Token, error) { … } func (dec *Decoder) tokenError(c byte) (Token, error) { … } // More reports whether there is another element in the // current array or object being parsed. func (dec *Decoder) More() bool { … } func (dec *Decoder) peek() (byte, error) { … } // InputOffset returns the input stream byte offset of the current decoder position. // The offset gives the location of the end of the most recently returned token // and the beginning of the next token. func (dec *Decoder) InputOffset() int64 { … }