package json
import "github.com/aws/smithy-go/encoding/json"
Index ¶
- func CollectUnknownField(decoder *json.Decoder) ([]byte, error)
- func DiscardUnknownField(decoder *json.Decoder) error
- type Array
- type Encoder
- type Object
- type Value
- func (jv Value) Array() *Array
- func (jv Value) Base64EncodeBytes(v []byte)
- func (jv Value) BigDecimal(v *big.Float)
- func (jv Value) BigInteger(v *big.Int)
- func (jv Value) Boolean(v bool)
- func (jv Value) Byte(v int8)
- func (jv Value) Double(v float64)
- func (jv Value) Float(v float32)
- func (jv Value) Integer(v int32)
- func (jv Value) Long(v int64)
- func (jv Value) Null()
- func (jv Value) Object() *Object
- func (jv Value) Short(v int16)
- func (jv Value) String(v string)
- func (jv Value) ULong(v uint64)
- func (jv Value) Write(v []byte)
Functions ¶
func CollectUnknownField ¶
CollectUnknownField grabs the contents of unknown fields from the decoder body and returns them as a byte slice. This is useful for skipping unknown fields without completely discarding them.
func DiscardUnknownField ¶
DiscardUnknownField discards unknown fields from a decoder body. This function is useful while deserializing a JSON body with additional unknown information that should be discarded.
Types ¶
type Array ¶
type Array struct {
// contains filtered or unexported fields
}
Array represents the encoding of a JSON Array
func (*Array) Close ¶
func (a *Array) Close()
Close encodes the end of the JSON Array
func (*Array) Value ¶
Value adds a new element to the JSON Array. Returns a Value type that is used to encode the array element.
type Encoder ¶
type Encoder struct { Value // contains filtered or unexported fields }
Encoder is JSON encoder that supports construction of JSON values using methods.
func NewEncoder ¶
func NewEncoder() *Encoder
NewEncoder returns a new JSON encoder
func (Encoder) Bytes ¶
Bytes returns the []byte slice of the JSON encoder
func (Encoder) String ¶
String returns the String output of the JSON encoder
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
Object represents the encoding of a JSON Object type
func (*Object) Close ¶
func (o *Object) Close()
Close encodes the end of the JSON Object
func (*Object) Key ¶
Key adds the given named key to the JSON object. Returns a Value encoder that should be used to encode a JSON value type.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value represents a JSON Value type JSON Value types: Object, Array, String, Number, Boolean, and Null
func (Value) Array ¶
Array returns a new Array encoder
func (Value) Base64EncodeBytes ¶
Base64EncodeBytes writes v as a base64 value in JSON string
func (Value) BigDecimal ¶
BigDecimal encodes v as JSON value
func (Value) BigInteger ¶
BigInteger encodes v as JSON value
func (Value) Boolean ¶
Boolean encodes v as a JSON boolean
func (Value) Byte ¶
Byte encodes v as a JSON number
func (Value) Double ¶
Double encodes v as a JSON number
func (Value) Float ¶
Float encodes v as a JSON number
func (Value) Integer ¶
Integer encodes v as a JSON number
func (Value) Long ¶
Long encodes v as a JSON number
func (Value) Null ¶
func (jv Value) Null()
Null encodes a null JSON value
func (Value) Object ¶
Object returns a new Object encoder
func (Value) Short ¶
Short encodes v as a JSON number
func (Value) String ¶
String encodes v as a JSON string
func (Value) ULong ¶
ULong encodes v as a JSON number
func (Value) Write ¶
Write writes v directly to the JSON document
Source Files ¶
array.go constants.go decoder_util.go encoder.go escape.go object.go value.go
- Version
- v1.22.3 (latest)
- Published
- Feb 17, 2025
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 3 weeks ago –
Tools for package owners.