Documentation ¶
Overview ¶
Package jsonserialization is the default Kiota serialization implementation for JSON. It relies on the standard Go JSON library.
Index ¶
- func Marshal(v absser.Parsable) ([]byte, error)
- func Unmarshal[T absser.Parsable](data []byte, model *T, parser absser.ParsableFactory) error
- type JsonParseNode
- func (n *JsonParseNode) GetBoolValue() (*bool, error)
- func (n *JsonParseNode) GetByteArrayValue() ([]byte, error)
- func (n *JsonParseNode) GetByteValue() (*byte, error)
- func (n *JsonParseNode) GetChildNode(index string) (absser.ParseNode, error)
- func (n *JsonParseNode) GetCollectionOfEnumValues(parser absser.EnumFactory) ([]interface{}, error)
- func (n *JsonParseNode) GetCollectionOfObjectValues(ctor absser.ParsableFactory) ([]absser.Parsable, error)
- func (n *JsonParseNode) GetCollectionOfPrimitiveValues(targetType string) ([]interface{}, error)
- func (n *JsonParseNode) GetDateOnlyValue() (*absser.DateOnly, error)
- func (n *JsonParseNode) GetEnumValue(parser absser.EnumFactory) (interface{}, error)
- func (n *JsonParseNode) GetFloat32Value() (*float32, error)
- func (n *JsonParseNode) GetFloat64Value() (*float64, error)
- func (n *JsonParseNode) GetISODurationValue() (*absser.ISODuration, error)
- func (n *JsonParseNode) GetInt32Value() (*int32, error)
- func (n *JsonParseNode) GetInt64Value() (*int64, error)
- func (n *JsonParseNode) GetInt8Value() (*int8, error)
- func (n *JsonParseNode) GetObjectValue(ctor absser.ParsableFactory) (absser.Parsable, error)
- func (n *JsonParseNode) GetOnAfterAssignFieldValues() absser.ParsableAction
- func (n *JsonParseNode) GetOnBeforeAssignFieldValues() absser.ParsableAction
- func (n *JsonParseNode) GetRawValue() (interface{}, error)
- func (n *JsonParseNode) GetStringValue() (*string, error)
- func (n *JsonParseNode) GetTimeOnlyValue() (*absser.TimeOnly, error)
- func (n *JsonParseNode) GetTimeValue() (*time.Time, error)
- func (n *JsonParseNode) GetUUIDValue() (*uuid.UUID, error)
- func (n *JsonParseNode) SetOnAfterAssignFieldValues(action absser.ParsableAction) error
- func (n *JsonParseNode) SetOnBeforeAssignFieldValues(action absser.ParsableAction) error
- func (n *JsonParseNode) SetValue(value interface{})
- type JsonParseNodeFactory
- type JsonSerializationWriter
- func (w *JsonSerializationWriter) Close() error
- func (w *JsonSerializationWriter) GetOnAfterObjectSerialization() absser.ParsableAction
- func (w *JsonSerializationWriter) GetOnBeforeSerialization() absser.ParsableAction
- func (w *JsonSerializationWriter) GetOnStartObjectSerialization() absser.ParsableWriter
- func (w *JsonSerializationWriter) GetSerializedContent() ([]byte, error)
- func (w *JsonSerializationWriter) Reset() error
- func (w *JsonSerializationWriter) SetOnAfterObjectSerialization(action absser.ParsableAction) error
- func (w *JsonSerializationWriter) SetOnBeforeSerialization(action absser.ParsableAction) error
- func (w *JsonSerializationWriter) SetOnStartObjectSerialization(writer absser.ParsableWriter) error
- func (w *JsonSerializationWriter) WriteAdditionalData(value map[string]interface{}) error
- func (w *JsonSerializationWriter) WriteAnyValue(key string, value interface{}) error
- func (w *JsonSerializationWriter) WriteBoolValue(key string, value *bool) error
- func (w *JsonSerializationWriter) WriteByteArrayValue(key string, value []byte) error
- func (w *JsonSerializationWriter) WriteByteValue(key string, value *byte) error
- func (w *JsonSerializationWriter) WriteCollectionOfBoolValues(key string, collection []bool) error
- func (w *JsonSerializationWriter) WriteCollectionOfByteValues(key string, collection []byte) error
- func (w *JsonSerializationWriter) WriteCollectionOfDateOnlyValues(key string, collection []absser.DateOnly) error
- func (w *JsonSerializationWriter) WriteCollectionOfFloat32Values(key string, collection []float32) error
- func (w *JsonSerializationWriter) WriteCollectionOfFloat64Values(key string, collection []float64) error
- func (w *JsonSerializationWriter) WriteCollectionOfISODurationValues(key string, collection []absser.ISODuration) error
- func (w *JsonSerializationWriter) WriteCollectionOfInt32Values(key string, collection []int32) error
- func (w *JsonSerializationWriter) WriteCollectionOfInt64Values(key string, collection []int64) error
- func (w *JsonSerializationWriter) WriteCollectionOfInt8Values(key string, collection []int8) error
- func (w *JsonSerializationWriter) WriteCollectionOfObjectValues(key string, collection []absser.Parsable) error
- func (w *JsonSerializationWriter) WriteCollectionOfStringValues(key string, collection []string) error
- func (w *JsonSerializationWriter) WriteCollectionOfTimeOnlyValues(key string, collection []absser.TimeOnly) error
- func (w *JsonSerializationWriter) WriteCollectionOfTimeValues(key string, collection []time.Time) error
- func (w *JsonSerializationWriter) WriteCollectionOfUUIDValues(key string, collection []uuid.UUID) error
- func (w *JsonSerializationWriter) WriteDateOnlyValue(key string, value *absser.DateOnly) error
- func (w *JsonSerializationWriter) WriteFloat32Value(key string, value *float32) error
- func (w *JsonSerializationWriter) WriteFloat64Value(key string, value *float64) error
- func (w *JsonSerializationWriter) WriteISODurationValue(key string, value *absser.ISODuration) error
- func (w *JsonSerializationWriter) WriteInt32Value(key string, value *int32) error
- func (w *JsonSerializationWriter) WriteInt64Value(key string, value *int64) error
- func (w *JsonSerializationWriter) WriteInt8Value(key string, value *int8) error
- func (w *JsonSerializationWriter) WriteNullValue(key string) error
- func (w *JsonSerializationWriter) WriteObjectValue(key string, item absser.Parsable, additionalValuesToMerge ...absser.Parsable) error
- func (w *JsonSerializationWriter) WriteStringValue(key string, value *string) error
- func (w *JsonSerializationWriter) WriteTimeOnlyValue(key string, value *absser.TimeOnly) error
- func (w *JsonSerializationWriter) WriteTimeValue(key string, value *time.Time) error
- func (w *JsonSerializationWriter) WriteUUIDValue(key string, value *uuid.UUID) error
- type JsonSerializationWriterFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶ added in v0.9.0
Marshal JSON-encodes a Parsable value. To enable dirty tracking and better performance, set the DefaultSerializationWriterFactoryInstance for "application/json".
Types ¶
type JsonParseNode ¶
type JsonParseNode struct {
// contains filtered or unexported fields
}
JsonParseNode is a ParseNode implementation for JSON.
func NewJsonParseNode ¶
func NewJsonParseNode(content []byte) (*JsonParseNode, error)
NewJsonParseNode creates a new JsonParseNode.
func (*JsonParseNode) GetBoolValue ¶
func (n *JsonParseNode) GetBoolValue() (*bool, error)
GetBoolValue returns a Bool value from the nodes.
func (*JsonParseNode) GetByteArrayValue ¶
func (n *JsonParseNode) GetByteArrayValue() ([]byte, error)
GetByteArrayValue returns a ByteArray value from the nodes.
func (*JsonParseNode) GetByteValue ¶
func (n *JsonParseNode) GetByteValue() (*byte, error)
GetBoolValue returns a Bool value from the nodes.
func (*JsonParseNode) GetChildNode ¶
func (n *JsonParseNode) GetChildNode(index string) (absser.ParseNode, error)
GetChildNode returns a new parse node for the given identifier.
func (*JsonParseNode) GetCollectionOfEnumValues ¶
func (n *JsonParseNode) GetCollectionOfEnumValues(parser absser.EnumFactory) ([]interface{}, error)
GetCollectionOfEnumValues returns the collection of Enum values from the node.
func (*JsonParseNode) GetCollectionOfObjectValues ¶
func (n *JsonParseNode) GetCollectionOfObjectValues(ctor absser.ParsableFactory) ([]absser.Parsable, error)
GetCollectionOfObjectValues returns the collection of Parsable values from the node.
func (*JsonParseNode) GetCollectionOfPrimitiveValues ¶
func (n *JsonParseNode) GetCollectionOfPrimitiveValues(targetType string) ([]interface{}, error)
GetCollectionOfPrimitiveValues returns the collection of primitive values from the node.
func (*JsonParseNode) GetDateOnlyValue ¶
func (n *JsonParseNode) GetDateOnlyValue() (*absser.DateOnly, error)
GetDateOnlyValue returns a DateOnly value from the nodes.
func (*JsonParseNode) GetEnumValue ¶
func (n *JsonParseNode) GetEnumValue(parser absser.EnumFactory) (interface{}, error)
GetEnumValue returns a Enum value from the nodes.
func (*JsonParseNode) GetFloat32Value ¶
func (n *JsonParseNode) GetFloat32Value() (*float32, error)
GetFloat32Value returns a Float32 value from the nodes.
func (*JsonParseNode) GetFloat64Value ¶
func (n *JsonParseNode) GetFloat64Value() (*float64, error)
GetFloat64Value returns a Float64 value from the nodes.
func (*JsonParseNode) GetISODurationValue ¶
func (n *JsonParseNode) GetISODurationValue() (*absser.ISODuration, error)
GetISODurationValue returns a ISODuration value from the nodes.
func (*JsonParseNode) GetInt32Value ¶
func (n *JsonParseNode) GetInt32Value() (*int32, error)
GetInt32Value returns a Int32 value from the nodes.
func (*JsonParseNode) GetInt64Value ¶
func (n *JsonParseNode) GetInt64Value() (*int64, error)
GetInt64Value returns a Int64 value from the nodes.
func (*JsonParseNode) GetInt8Value ¶
func (n *JsonParseNode) GetInt8Value() (*int8, error)
GetInt8Value returns a int8 value from the nodes.
func (*JsonParseNode) GetObjectValue ¶
func (n *JsonParseNode) GetObjectValue(ctor absser.ParsableFactory) (absser.Parsable, error)
GetObjectValue returns the Parsable value from the node.
func (*JsonParseNode) GetOnAfterAssignFieldValues ¶ added in v0.8.0
func (n *JsonParseNode) GetOnAfterAssignFieldValues() absser.ParsableAction
func (*JsonParseNode) GetOnBeforeAssignFieldValues ¶ added in v0.8.0
func (n *JsonParseNode) GetOnBeforeAssignFieldValues() absser.ParsableAction
func (*JsonParseNode) GetRawValue ¶ added in v0.7.0
func (n *JsonParseNode) GetRawValue() (interface{}, error)
GetRawValue returns a ByteArray value from the nodes.
func (*JsonParseNode) GetStringValue ¶
func (n *JsonParseNode) GetStringValue() (*string, error)
GetStringValue returns a String value from the nodes.
func (*JsonParseNode) GetTimeOnlyValue ¶
func (n *JsonParseNode) GetTimeOnlyValue() (*absser.TimeOnly, error)
GetTimeOnlyValue returns a TimeOnly value from the nodes.
func (*JsonParseNode) GetTimeValue ¶
func (n *JsonParseNode) GetTimeValue() (*time.Time, error)
GetTimeValue returns a Time value from the nodes.
func (*JsonParseNode) GetUUIDValue ¶
func (n *JsonParseNode) GetUUIDValue() (*uuid.UUID, error)
GetUUIDValue returns a UUID value from the nodes.
func (*JsonParseNode) SetOnAfterAssignFieldValues ¶ added in v0.8.0
func (n *JsonParseNode) SetOnAfterAssignFieldValues(action absser.ParsableAction) error
func (*JsonParseNode) SetOnBeforeAssignFieldValues ¶ added in v0.8.0
func (n *JsonParseNode) SetOnBeforeAssignFieldValues(action absser.ParsableAction) error
func (*JsonParseNode) SetValue ¶
func (n *JsonParseNode) SetValue(value interface{})
SetValue is obsolete, parse nodes are not meant to be settable externally
type JsonParseNodeFactory ¶
type JsonParseNodeFactory struct { }
JsonParseNodeFactory is a ParseNodeFactory implementation for JSON
func NewJsonParseNodeFactory ¶
func NewJsonParseNodeFactory() *JsonParseNodeFactory
NewJsonParseNodeFactory creates a new JsonParseNodeFactory
func (*JsonParseNodeFactory) GetRootParseNode ¶
func (f *JsonParseNodeFactory) GetRootParseNode(contentType string, content []byte) (absser.ParseNode, error)
GetRootParseNode return a new ParseNode instance that is the root of the content
func (*JsonParseNodeFactory) GetValidContentType ¶
func (f *JsonParseNodeFactory) GetValidContentType() (string, error)
GetValidContentType returns the content type this factory's parse nodes can deserialize.
type JsonSerializationWriter ¶
type JsonSerializationWriter struct {
// contains filtered or unexported fields
}
JsonSerializationWriter implements SerializationWriter for JSON.
func NewJsonSerializationWriter ¶
func NewJsonSerializationWriter() *JsonSerializationWriter
NewJsonSerializationWriter creates a new instance of the JsonSerializationWriter.
func (*JsonSerializationWriter) Close ¶
func (w *JsonSerializationWriter) Close() error
Close relases the internal buffer. Subsequent calls to the writer will panic.
func (*JsonSerializationWriter) GetOnAfterObjectSerialization ¶ added in v0.8.0
func (w *JsonSerializationWriter) GetOnAfterObjectSerialization() absser.ParsableAction
func (*JsonSerializationWriter) GetOnBeforeSerialization ¶ added in v0.8.0
func (w *JsonSerializationWriter) GetOnBeforeSerialization() absser.ParsableAction
func (*JsonSerializationWriter) GetOnStartObjectSerialization ¶ added in v0.8.0
func (w *JsonSerializationWriter) GetOnStartObjectSerialization() absser.ParsableWriter
func (*JsonSerializationWriter) GetSerializedContent ¶
func (w *JsonSerializationWriter) GetSerializedContent() ([]byte, error)
GetSerializedContent returns the resulting byte array from the serialization writer.
func (*JsonSerializationWriter) Reset ¶ added in v0.9.3
func (w *JsonSerializationWriter) Reset() error
Reset sets the internal buffer to empty, allowing the writer to be reused.
func (*JsonSerializationWriter) SetOnAfterObjectSerialization ¶ added in v0.8.0
func (w *JsonSerializationWriter) SetOnAfterObjectSerialization(action absser.ParsableAction) error
func (*JsonSerializationWriter) SetOnBeforeSerialization ¶ added in v0.8.0
func (w *JsonSerializationWriter) SetOnBeforeSerialization(action absser.ParsableAction) error
func (*JsonSerializationWriter) SetOnStartObjectSerialization ¶ added in v0.8.0
func (w *JsonSerializationWriter) SetOnStartObjectSerialization(writer absser.ParsableWriter) error
func (*JsonSerializationWriter) WriteAdditionalData ¶
func (w *JsonSerializationWriter) WriteAdditionalData(value map[string]interface{}) error
WriteAdditionalData writes additional data to underlying the byte array.
func (*JsonSerializationWriter) WriteAnyValue ¶ added in v0.7.1
func (w *JsonSerializationWriter) WriteAnyValue(key string, value interface{}) error
WriteAnyValue an unknown value as a parameter.
func (*JsonSerializationWriter) WriteBoolValue ¶
func (w *JsonSerializationWriter) WriteBoolValue(key string, value *bool) error
WriteBoolValue writes a Bool value to underlying the byte array.
func (*JsonSerializationWriter) WriteByteArrayValue ¶
func (w *JsonSerializationWriter) WriteByteArrayValue(key string, value []byte) error
WriteByteArrayValue writes a ByteArray value to underlying the byte array.
func (*JsonSerializationWriter) WriteByteValue ¶
func (w *JsonSerializationWriter) WriteByteValue(key string, value *byte) error
WriteByteValue writes a Byte value to underlying the byte array.
func (*JsonSerializationWriter) WriteCollectionOfBoolValues ¶
func (w *JsonSerializationWriter) WriteCollectionOfBoolValues(key string, collection []bool) error
WriteCollectionOfBoolValues writes a collection of Bool values to underlying the byte array.
func (*JsonSerializationWriter) WriteCollectionOfByteValues ¶
func (w *JsonSerializationWriter) WriteCollectionOfByteValues(key string, collection []byte) error
WriteCollectionOfByteValues writes a collection of Byte values to underlying the byte array.
func (*JsonSerializationWriter) WriteCollectionOfDateOnlyValues ¶
func (w *JsonSerializationWriter) WriteCollectionOfDateOnlyValues(key string, collection []absser.DateOnly) error
WriteCollectionOfDateOnlyValues writes a collection of DateOnly values to underlying the byte array.
func (*JsonSerializationWriter) WriteCollectionOfFloat32Values ¶
func (w *JsonSerializationWriter) WriteCollectionOfFloat32Values(key string, collection []float32) error
WriteCollectionOfFloat32Values writes a collection of Float32 values to underlying the byte array.
func (*JsonSerializationWriter) WriteCollectionOfFloat64Values ¶
func (w *JsonSerializationWriter) WriteCollectionOfFloat64Values(key string, collection []float64) error
WriteCollectionOfFloat64Values writes a collection of Float64 values to underlying the byte array.
func (*JsonSerializationWriter) WriteCollectionOfISODurationValues ¶
func (w *JsonSerializationWriter) WriteCollectionOfISODurationValues(key string, collection []absser.ISODuration) error
WriteCollectionOfISODurationValues writes a collection of ISODuration values to underlying the byte array.
func (*JsonSerializationWriter) WriteCollectionOfInt32Values ¶
func (w *JsonSerializationWriter) WriteCollectionOfInt32Values(key string, collection []int32) error
WriteCollectionOfInt32Values writes a collection of Int32 values to underlying the byte array.
func (*JsonSerializationWriter) WriteCollectionOfInt64Values ¶
func (w *JsonSerializationWriter) WriteCollectionOfInt64Values(key string, collection []int64) error
WriteCollectionOfInt64Values writes a collection of Int64 values to underlying the byte array.
func (*JsonSerializationWriter) WriteCollectionOfInt8Values ¶
func (w *JsonSerializationWriter) WriteCollectionOfInt8Values(key string, collection []int8) error
WriteCollectionOfInt8Values writes a collection of int8 values to underlying the byte array.
func (*JsonSerializationWriter) WriteCollectionOfObjectValues ¶
func (w *JsonSerializationWriter) WriteCollectionOfObjectValues(key string, collection []absser.Parsable) error
WriteCollectionOfObjectValues writes a collection of Parsable values to underlying the byte array.
func (*JsonSerializationWriter) WriteCollectionOfStringValues ¶
func (w *JsonSerializationWriter) WriteCollectionOfStringValues(key string, collection []string) error
WriteCollectionOfStringValues writes a collection of String values to underlying the byte array.
func (*JsonSerializationWriter) WriteCollectionOfTimeOnlyValues ¶
func (w *JsonSerializationWriter) WriteCollectionOfTimeOnlyValues(key string, collection []absser.TimeOnly) error
WriteCollectionOfTimeOnlyValues writes a collection of TimeOnly values to underlying the byte array.
func (*JsonSerializationWriter) WriteCollectionOfTimeValues ¶
func (w *JsonSerializationWriter) WriteCollectionOfTimeValues(key string, collection []time.Time) error
WriteCollectionOfTimeValues writes a collection of Time values to underlying the byte array.
func (*JsonSerializationWriter) WriteCollectionOfUUIDValues ¶
func (w *JsonSerializationWriter) WriteCollectionOfUUIDValues(key string, collection []uuid.UUID) error
WriteCollectionOfUUIDValues writes a collection of UUID values to underlying the byte array.
func (*JsonSerializationWriter) WriteDateOnlyValue ¶
func (w *JsonSerializationWriter) WriteDateOnlyValue(key string, value *absser.DateOnly) error
WriteDateOnlyValue writes a DateOnly value to underlying the byte array.
func (*JsonSerializationWriter) WriteFloat32Value ¶
func (w *JsonSerializationWriter) WriteFloat32Value(key string, value *float32) error
WriteFloat32Value writes a Float32 value to underlying the byte array.
func (*JsonSerializationWriter) WriteFloat64Value ¶
func (w *JsonSerializationWriter) WriteFloat64Value(key string, value *float64) error
WriteFloat64Value writes a Float64 value to underlying the byte array.
func (*JsonSerializationWriter) WriteISODurationValue ¶
func (w *JsonSerializationWriter) WriteISODurationValue(key string, value *absser.ISODuration) error
WriteISODurationValue writes a ISODuration value to underlying the byte array.
func (*JsonSerializationWriter) WriteInt32Value ¶
func (w *JsonSerializationWriter) WriteInt32Value(key string, value *int32) error
WriteInt32Value writes a Int32 value to underlying the byte array.
func (*JsonSerializationWriter) WriteInt64Value ¶
func (w *JsonSerializationWriter) WriteInt64Value(key string, value *int64) error
WriteInt64Value writes a Int64 value to underlying the byte array.
func (*JsonSerializationWriter) WriteInt8Value ¶
func (w *JsonSerializationWriter) WriteInt8Value(key string, value *int8) error
WriteInt8Value writes a int8 value to underlying the byte array.
func (*JsonSerializationWriter) WriteNullValue ¶ added in v0.8.0
func (w *JsonSerializationWriter) WriteNullValue(key string) error
func (*JsonSerializationWriter) WriteObjectValue ¶
func (w *JsonSerializationWriter) WriteObjectValue(key string, item absser.Parsable, additionalValuesToMerge ...absser.Parsable) error
WriteObjectValue writes a Parsable value to underlying the byte array.
func (*JsonSerializationWriter) WriteStringValue ¶
func (w *JsonSerializationWriter) WriteStringValue(key string, value *string) error
WriteStringValue writes a String value to underlying the byte array.
func (*JsonSerializationWriter) WriteTimeOnlyValue ¶
func (w *JsonSerializationWriter) WriteTimeOnlyValue(key string, value *absser.TimeOnly) error
WriteTimeOnlyValue writes a TimeOnly value to underlying the byte array.
func (*JsonSerializationWriter) WriteTimeValue ¶
func (w *JsonSerializationWriter) WriteTimeValue(key string, value *time.Time) error
WriteTimeValue writes a Time value to underlying the byte array.
func (*JsonSerializationWriter) WriteUUIDValue ¶
func (w *JsonSerializationWriter) WriteUUIDValue(key string, value *uuid.UUID) error
WriteUUIDValue writes a UUID value to underlying the byte array.
type JsonSerializationWriterFactory ¶
type JsonSerializationWriterFactory struct { }
JsonSerializationWriterFactory implements SerializationWriterFactory for JSON.
func NewJsonSerializationWriterFactory ¶
func NewJsonSerializationWriterFactory() *JsonSerializationWriterFactory
NewJsonSerializationWriterFactory creates a new instance of the JsonSerializationWriterFactory.
func (*JsonSerializationWriterFactory) GetSerializationWriter ¶
func (f *JsonSerializationWriterFactory) GetSerializationWriter(contentType string) (absser.SerializationWriter, error)
GetSerializationWriter returns the relevant SerializationWriter instance for the given content type
func (*JsonSerializationWriterFactory) GetValidContentType ¶
func (f *JsonSerializationWriterFactory) GetValidContentType() (string, error)
GetValidContentType returns the valid content type for the SerializationWriterFactoryRegistry