package
0.0.0-20240815175050-ebd3a8989ca1
Repository: https://github.com/go-json-experiment/json.git
Documentation: pkg.go.dev
# Functions
AllowDuplicateNames specifies that JSON objects may contain duplicate member names.
AllowInvalidUTF8 specifies that JSON strings may contain invalid UTF-8, which will be mangled as the Unicode replacement character, U+FFFD.
AppendQuote appends a double-quoted JSON string literal representing src to dst and returns the extended buffer.
AppendUnquote appends the decoded interpretation of src as a double-quoted JSON string literal to dst and returns the extended buffer.
Bool constructs a Token representing a JSON boolean.
EscapeForHTML specifies that '<', '>', and '&' characters within JSON strings should be escaped as a hexadecimal Unicode codepoint (e.g., \u003c) so that the output is safe to embed within HTML.
EscapeForJS specifies that U+2028 and U+2029 characters within JSON strings should be escaped as a hexadecimal Unicode codepoint (e.g., \u2028) so that the output is valid to embed within JavaScript.
Float constructs a Token representing a JSON number.
Int constructs a Token representing a JSON number from an int64.
Multiline specifies that the JSON output should expand to multiple lines, where every JSON object member or JSON array element appears on a new, indented line according to the nesting depth.
NewDecoder constructs a new streaming decoder reading from r.
NewEncoder constructs a new streaming encoder writing to w configured with the provided options.
SpaceAfterColon specifies that the JSON output should emit a space character after each colon separator following a JSON object name.
SpaceAfterComma specifies that the JSON output should emit a space character after each comma separator following a JSON object value or array element.
String constructs a Token representing a JSON string.
Uint constructs a Token representing a JSON number from a uint64.
WithIndent specifies that the encoder should emit multiline output where each element in a JSON object or array begins on a new, indented line beginning with the indent prefix (see [WithIndentPrefix]) followed by one or more copies of indent according to the nesting depth.
WithIndentPrefix specifies that the encoder should emit multiline output where each element in a JSON object or array begins on a new, indented line beginning with the indent prefix followed by one or more copies of indent (see [WithIndent]) according to the nesting depth.
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
Internal is for internal use only.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
Decoder is a streaming decoder for raw JSON tokens and values.
Encoder is a streaming encoder from raw JSON tokens and values.
SyntacticError is a description of a syntactic error that occurred when encoding or decoding JSON according to the grammar.
Token represents a lexical JSON token, which may be one of the following: - a JSON literal (i.e., null, true, or false) - a JSON string (e.g., "hello, world!") - a JSON number (e.g., 123.456) - a start or end delimiter for a JSON object (i.e., { or } ) - a start or end delimiter for a JSON array (i.e., [ or ] )
A Token cannot represent entire array or object values, while a [Value] can.
# Type aliases
Kind represents each possible JSON token kind with a single byte, which is conveniently the first byte of that kind's grammar with the restriction that numbers always be represented with '0':
- 'n': null - 'f': false - 't': true - '"': string - '0': number - '{': object start - '}': object end - '[': array start - ']': array end
An invalid kind is usually represented using 0, but may be non-zero due to invalid JSON data.
Options configures [NewEncoder], [Encoder.Reset], [NewDecoder], and [Decoder.Reset] with specific features.
Pointer is a JSON Pointer (RFC 6901) that references a particular JSON value relative to the root of the top-level JSON value.
Value represents a single raw JSON value, which may be one of the following: - a JSON literal (i.e., null, true, or false) - a JSON string (e.g., "hello, world!") - a JSON number (e.g., 123.456) - an entire JSON object (e.g., {"fizz":"buzz"} ) - an entire JSON array (e.g., [1,2,3] )
Value can represent entire array or object values, while [Token] cannot.