Documentation
¶
Index ¶
- Variables
- func AppendStringWTF8(dst []byte, src string) []byte
- func Clone(v any) any
- func DecodeBytes(b []byte) (string, error)
- func DecodeWTF8(data []byte) (any, error)
- func DecodeWTF8Numbers(data []byte) (any, error)
- func DecodeWTF8Ordered(data []byte) (any, error)
- func Dict(v any) (map[string]any, bool)
- func Dumps(v any, opts ...Option) (string, error)
- func EncodeWTF8(v any) ([]byte, error)
- func EncodeWTF8Indent(v any, prefix, indent string) ([]byte, error)
- func EncodeWTF8Python(v any) ([]byte, error)
- func EncodeWTF8PythonASCII(v any) ([]byte, error)
- func Equal(a, b any) bool
- func EscapeNonASCII(out []byte) []byte
- func Loads(text string) (any, error)
- func LoadsBytes(b []byte) (any, error)
- func LoadsBytesPairsHook(b []byte, hook func(keys []string, vals []any) (any, error)) (any, error)
- func LoadsLenient(text string) (any, error)
- func LoadsOrdered(data []byte) (any, error)
- func LoadsPairsHook(text string, hook func(keys []string, vals []any) (any, error)) (any, error)
- func LoadsPartial(text string) (any, error)
- func Ordered(v any) any
- func ParseInt(text string) any
- func Plain(v any) any
- func RawDecode(text string) (any, int, error)
- func SafeLoads(v any, def any) any
- func SpaceSeparators(compact []byte) []byte
- func WTF8Shape(v any) any
- type DecodeError
- type Object
- func (o *Object) Copy() *Object
- func (o *Object) Delete(key string) bool
- func (o *Object) Get(key string) (any, bool)
- func (o *Object) GetOr(key string, def any) any
- func (o *Object) Len() int
- func (o *Object) MarshalJSON() ([]byte, error)
- func (o *Object) Pop(key string) (any, bool)
- func (o *Object) PyItems() iter.Seq2[any, any]
- func (o *Object) Set(key string, v any)
- func (o *Object) UnmarshalJSON(data []byte) error
- func (o *Object) Update(other *Object)
- type Option
- type TypeError
Constants ¶
This section is empty.
Variables ¶
var ErrCircular = errors.New("Circular reference detected")
ValueError json.dumps raises when check_circular finds a container inside itself
var ErrOutOfRange = errors.New("Out of range float values are not JSON compliant")
ValueError json.dumps raises for a NaN or infinite float when allow_nan is false
var ErrRecursion = errors.New("maximum recursion depth exceeded while encoding a JSON object")
RecursionError for a default hook that keeps returning values needing default past the interpreter limit
Functions ¶
func AppendStringWTF8 ¶
Quoted JSON string of WTF-8 text, surrogates kept as their code points and stray bytes as surrogateescape chars
func Clone ¶
Deep copy keeping every Object ordered, copying maps, lists and values that rebuild themselves
func DecodeBytes ¶
Text of bytes under json.detect_encoding, decoded with surrogatepass, the UnicodeDecodeError on bad input
func DecodeWTF8 ¶
Decodes JSON into the encoding/json any shapes with lone surrogate escapes kept as WTF-8 code points
func DecodeWTF8Numbers ¶
Decodes JSON into plain maps with numbers as json.Number text so ints stay apart from floats
func DecodeWTF8Ordered ¶
Decodes JSON with objects as insertion ordered dicts and numbers as json.Number text
func Dict ¶
Read view of a dict value, a plain map itself or the value map of an Object, false for anything else
func EncodeWTF8 ¶
Encodes like json.dumps with ensure_ascii false, encoding/json value shapes without HTML escaping and surrogates as code points
func EncodeWTF8Indent ¶
Indented form of EncodeWTF8 with the encoding/json Encoder indent layout
func EncodeWTF8Python ¶
Text of json.dumps with ensure_ascii false and the default comma space and colon space separators
func EncodeWTF8PythonASCII ¶
Text of json.dumps with every default, characters outside space to tilde escaped and separators spaced
func Equal ¶
Python equality of decoded JSON values, dicts ignoring key order and numbers comparing across int, float and bool
func EscapeNonASCII ¶
Rewrites each non ASCII character of encoded JSON as backslash u escapes, astral ones as a surrogate pair
func Loads ¶
json.loads of text into ordered objects, int64 or big.Int ints, float64 floats and WTF-8 strings
func LoadsBytes ¶
json.loads of bytes, decoded under json.detect_encoding with surrogatepass first
func LoadsBytesPairsHook ¶
json.loads of bytes under json.detect_encoding with object_pairs_hook
func LoadsLenient ¶
json.loads with strict=False, control characters accepted raw inside strings
func LoadsOrdered ¶
JSON value with objects as Object in wire key order and numbers kept as json.Number text
func LoadsPairsHook ¶
json.loads with object_pairs_hook, each object built by hook from its keys and values in order
func LoadsPartial ¶
Plain value of a JSON prefix like jiter partial mode, open containers closed and incomplete strings and literals dropped
func Ordered ¶
Value with every string keyed dict at any depth turned into an Object, plain map keys sorted
func Plain ¶
Decoded JSON with every Object turned into a plain map and every map and list copied, scalars unchanged
func RawDecode ¶
json.JSONDecoder().raw_decode of text from its first character, the value and the rune offset after it
func SafeLoads ¶
utils.safe_json_loads, json.loads of a str or bytes value with def returned for any decode error or non text argument
func SpaceSeparators ¶
Adds the space json.dumps writes after each item comma and key colon of compact JSON text
Types ¶
type DecodeError ¶
JSON decode error formatted with line, column and character offset like json.JSONDecodeError
func (*DecodeError) Error ¶
func (e *DecodeError) Error() string
func (*DecodeError) PyTypeName ¶
func (e *DecodeError) PyTypeName() string
type Object ¶
Insertion ordered JSON object with dict semantics, a reassigned key keeping its first position
func AsObject ¶
Object view of a dict value, a plain map entering with sorted keys, false for anything else
func LoadsDict ¶
Decoded JSON object of text, the AttributeError a dict get call raises on any other decoded value
func (*Object) MarshalJSON ¶
Writes keys in insertion order with encoding/json compact spacing and surrogates kept as code points
func (*Object) Pop ¶
Removes key and returns its value and whether it was present, the dict.pop analogue
func (*Object) UnmarshalJSON ¶
Decodes a JSON object the way json.loads does, keys kept in document order
type Option ¶
type Option func(*options)
One json.dumps keyword argument
func Separators ¶
separators as the item and key separator pair
type TypeError ¶
type TypeError struct{ Msg string }
TypeError json.dumps raises for a value neither encodable nor converted by default
func (*TypeError) PyTypeName ¶
Python exception class name the error stands for