Table of Contents

Class JsonConversion.JsonConverter<T, JsonDataType>

Namespace
PAC.Json

An interface that custom JSON converters must implement.

NOTE: Has a default implementation for an overload FromJson(JsonData jsonData) that ensures it is of type JsonDataType before calling the specific overload FromJSON(JsonDataType jsonData).

public abstract class JsonConversion.JsonConverter<T, JsonDataType> where JsonDataType : JsonData

Type Parameters

T

The type the converter will convert to/from JSON.

JsonDataType

The type of JSON data the converter will convert to/from.

Inheritance
JsonConversion.JsonConverter<T, JsonDataType>
Derived
Inherited Members

Methods

FromJson(JsonData)

Attempts to convert the JSON data into a C# object of the given type. Ensures the JSON data is the correct type before calling the FromJson() overload for the specific type of JSON data.

public T FromJson(JsonData jsonData)

Parameters

jsonData JsonData

Returns

T

FromJson(JsonDataType)

Attempts to convert the JSON data into a C# object of the given type.

NOTE: JsonConverter has a default implementation for an overload FromJson(JsonData jsonData) that ensures it is of type JsonDataType before calling the specific overload FromJSON(JsonDataType jsonData).

public abstract T FromJson(JsonDataType jsonData)

Parameters

jsonData JsonDataType

Returns

T

ToJson(T)

Attempts to convert the C# object into JSON data.

public abstract JsonDataType ToJson(T obj)

Parameters

obj T

Returns

JsonDataType