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
Type | Name | Description |
---|---|---|
System.String | json | The source JSON |
Type Parameters
Name | Description |
---|---|
T | The 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
Type | Name | Description |
---|---|---|
System.String | json | The source JSON |
System.Type | type | The 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
Type | Name | Description |
---|---|---|
System.Object | source | An 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
Type | Name | Description |
---|---|---|
System.Byte[] | encodedJson | UTF8-encoded JSON string |
System.Type | type | The 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
Type | Name | Description |
---|---|---|
System.Byte[] | encodedJson | UTF8-encoded JSON string |
Type Parameters
Name | Description |
---|---|
T | The type to deserialize to |