Skip to main content

Interface IJsonSerializer

Provides an abstraction for a serializer tha can convert between objects and JSON strings

Assembly: Meadow.Contracts.dll
View Source
Declaration
public interface IJsonSerializer

Methods

Deserialize<T>(string)

Deserializes a provided string into a typed object

View Source
Declaration
T Deserialize<T>(string json)
Returns

<T>: An instance of T

Parameters
TypeNameDescription
System.StringjsonThe source JSON
Type Parameters
NameDescription
TThe type to deserialize to

Deserialize(string, Type)

Deserializes a provided string into a typed object

View Source
Declaration
object Deserialize(string json, Type type)
Returns

System.Object: An instance of 'type'

Parameters
TypeNameDescription
System.StringjsonThe source JSON
System.TypetypeThe type to deserialize to

Serialize(object)

Serializes an object to a JSON representation

View Source
Declaration
string? Serialize(object source)
Returns

System.String: A JSON representationof the source object

Parameters
TypeNameDescription
System.ObjectsourceAn object to serialize

Deserialize(byte[], Type)

Deserializes a provided string into a typed object

View Source
Declaration
object Deserialize(byte[] encodedJson, Type type)
Returns

System.Object: An instance of 'type'

Parameters
TypeNameDescription
System.Byte[]encodedJsonUTF8-encoded JSON string
System.TypetypeThe type to deserialize to

Deserialize<T>(byte[])

Deserializes a provided string into a typed object

View Source
Declaration
T Deserialize<T>(byte[] encodedJson)
Returns

<T>: An instance of T

Parameters
TypeNameDescription
System.Byte[]encodedJsonUTF8-encoded JSON string
Type Parameters
NameDescription
TThe type to deserialize to