package jsonflags
Import Path
encoding/json/internal/jsonflags (on go.dev)
Dependency Relation
imports one package, and imported by 5 packages
Involved Source Files
jsonflags implements all the optional boolean flags.
These flags are shared across both "json", "jsontext", and "jsonopts".
Package-Level Type Names (total 2)
Bools represents zero or more boolean flags, all set to true or false.
The least-significant bit is the boolean value of all flags in the set.
The remaining bits identify which particular flags.
In common usage, this is OR'd with 0 or 1. For example:
- (AllowInvalidUTF8 | 0) means "AllowInvalidUTF8 is false"
- (Multiline | Indent | 1) means "Multiline and Indent are true"
( Bools) JSONOptions(internal.NotForPublicUse)
Bools : encoding/json/internal/jsonopts.Options
func (*Flags).Clear(f Bools)
func Flags.Get(f Bools) bool
func Flags.Has(f Bools) bool
func (*Flags).Set(f Bools)
const AllArshalV1Flags
const AllArshalV2Flags
const AllCoderFlags
const AllFlags
const AllowDuplicateNames
const AllowInvalidUTF8
const AnyEscape
const AnyWhitespace
const ByteLimit
const CallMethodsWithLegacySemantics
const CanonicalizeNumbers
const CanonicalizeRawFloats
const CanonicalizeRawInts
const DefaultV1Flags
const DepthLimit
const Deterministic
const DiscardUnknownMembers
const EscapeForHTML
const EscapeForJS
const EscapeInvalidUTF8
const FormatBytesWithLegacySemantics
const FormatNilMapAsNull
const FormatNilSliceAsNull
const FormatTimeWithLegacySemantics
const Indent
const IndentPrefix
const Marshalers
const MatchCaseInsensitiveNames
const MatchCaseSensitiveDelimiter
const MergeWithLegacySemantics
const Multiline
const NonBooleanFlags
const OmitEmptyWithLegacyDefinition
const OmitTopLevelNewline
const OmitZeroStructFields
const PreserveRawStrings
const RejectUnknownMembers
const ReorderRawObjects
const ReportErrorsWithLegacySemantics
const SpaceAfterColon
const SpaceAfterComma
const StringifyBoolsAndStrings
const StringifyNumbers
const StringifyWithLegacySemantics
const UnmarshalAnyWithRawNumber
const UnmarshalArrayFromAnyLength
const Unmarshalers
const WhitespaceFlags
const WithinArshalCall
Flags is a set of boolean flags.
If the presence bit is zero, then the value bit must also be zero.
The least-significant bit of both fields is always zero.
Unlike Bools, which can represent a set of bools that are all true or false,
Flags represents a set of bools, each individually may be true or false.
Presence uint64
Values uint64
Clear clears both the presence and value for the provided bool or bools.
The value bit of f (i.e., the LSB) is ignored.
Get reports whether the bool (or any of the bools) is true.
This is generally only used with a singular bool.
The value bit of f (i.e., the LSB) is ignored.
Has reports whether the bool (or any of the bools) is set.
The value bit of f (i.e., the LSB) is ignored.
Join joins two sets of flags such that the latter takes precedence.
Set sets both the presence and value for the provided bool (or set of bools).
func (*Flags).Join(src Flags)
func encoding/json/internal/jsonwire.AppendQuote[Bytes](dst []byte, src Bytes, flags *Flags) ([]byte, error)
func encoding/json/internal/jsonwire.ReformatNumber(dst, src []byte, flags *Flags) ([]byte, int, error)
func encoding/json/internal/jsonwire.ReformatString(dst, src []byte, flags *Flags) ([]byte, int, error)
Package-Level Constants (total 49)
AllArshalV1Flags is the set of all v1 marshal/unmarshal flags.
AllArshalV2Flags is the set of all v2 marshal/unmarshal flags.
AllCoderFlags is the set of all encoder/decoder flags.
AllFlags is the set of all flags.
Encoder and decoder flags.
Encoder and decoder flags.
AnyEscape is the set of flags related to escaping in a JSON string.
AnyWhitespace reports whether the encoded output might have any whitespace.
Encoder and decoder flags.
Marshal and Unmarshal flags (for v1).
CanonicalizeNumbers is the set of flags related to raw number canonicalization.
Encoder and decoder flags.
Encoder and decoder flags.
DefaultV1Flags is the set of booleans flags that default to true under
v1 semantics. None of the non-boolean flags differ between v1 and v2.
Encoder and decoder flags.
Marshal and Unmarshal flags (for v2).
Marshal and Unmarshal flags (for v2).
Encoder and decoder flags.
Encoder and decoder flags.
Encoder and decoder flags.
Marshal and Unmarshal flags (for v1).
Marshal and Unmarshal flags (for v2).
Marshal and Unmarshal flags (for v2).
Marshal and Unmarshal flags (for v1).
Encoder and decoder flags.
Encoder and decoder flags.
Marshal and Unmarshal flags (for v2).
Marshal and Unmarshal flags (for v2).
Marshal and Unmarshal flags (for v1).
Marshal and Unmarshal flags (for v1).
Encoder and decoder flags.
NonBooleanFlags is the set of non-boolean flags,
where the value is some other concrete Go type.
The value of the flag is stored within jsonopts.Struct.
Marshal and Unmarshal flags (for v1).
Encoder and decoder flags.
Marshal and Unmarshal flags (for v2).
Encoder and decoder flags.
Marshal and Unmarshal flags (for v2).
Encoder and decoder flags.
Marshal and Unmarshal flags (for v1).
Encoder and decoder flags.
Encoder and decoder flags.
Marshal and Unmarshal flags (for v1).
Marshal and Unmarshal flags (for v2).
Marshal and Unmarshal flags (for v1).
Marshal and Unmarshal flags (for v1).
Marshal and Unmarshal flags (for v1).
Marshal and Unmarshal flags (for v2).
WhitespaceFlags is the set of flags related to whitespace formatting.
In contrast to AnyWhitespace, this includes Indent and IndentPrefix
as those settings take no effect if Multiline is false.
Encoder and decoder flags.
![]() |
The pages are generated with Golds v0.7.7-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |