SerializationModule

PackageFCQRS.Serialization
Provides JSON serialization and deserialization functionality for FCQRS.

Summary

NameSignatureSynopsis
jsonOptionsjsonOptions Default JSON serializer options configured for F# types, C# polymorphic types, and C# 15 discriminated unions.
encodeencode objSerializes an object to a JSON string.
decodedecode jsonDeserializes a JSON element to a strongly-typed object.
encodeToBytesencodeToBytes objSerializes an object to a UTF-8 byte array.
decodeFromBytesdecodeFromBytes jsonDeserializes a byte array to a strongly-typed object.

jsonOptions

jsonOptions
Member
Default JSON serializer options configured for F# types, C# polymorphic types, and C# 15 discriminated unions.

Returns

JsonSerializerOptions

encode

encode obj
Member
Serializes an object to a JSON string.

Parameters

NameTypeDescription
obj'aThe object to serialize.

Returns

string

decode

decode json
Member
Deserializes a JSON element to a strongly-typed object.

Parameters

NameTypeDescription
jsonJsonElementThe JSON element to deserialize.

Returns

'T

encodeToBytes

encodeToBytes obj
Member
Serializes an object to a UTF-8 byte array.

Parameters

NameTypeDescription
obj'aThe object to serialize.

Returns

byte[]

decodeFromBytes

decodeFromBytes json
Member
Deserializes a byte array to a strongly-typed object.

Parameters

NameTypeDescription
jsonbyte arrayThe byte array containing JSON data.

Returns

'T