[]
Deserializes a JSON string to an object.
Implement this method to reconstruct an application-specific object from its JSON representation. The concrete return type depends on the serializer implementation and how the JSON content is interpreted.
object Deserialize(string json)
Function Deserialize(json As String) As Object
| Type | Name | Description |
|---|---|---|
| string | json | The JSON string to deserialize. |
| Type | Description |
|---|---|
| object | The object created from the specified JSON string. |
public class SimpleJsonSerializer : IJsonSerializer
{
public string Serialize(object value)
{
return System.Text.Json.JsonSerializer.Serialize(new { value });
}
public object Deserialize(string json)
{
return System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, object>>(json);
}
}
IJsonSerializer serializer = new SimpleJsonSerializer();
object value = serializer.Deserialize("{\"value\":\"A\"}");