Table of Contents

Interface IJsSerializer

Namespace
SunamoInterfaces.Interfaces
Assembly
SunamoInterfaces.dll

Interface for JSON serialization and deserialization operations.

public interface IJsSerializer
Extension Methods

Methods

Deserialize(string, Type)

Deserializes JSON to an object of the specified type.

object Deserialize(string json, Type targetType)

Parameters

json string

The JSON string to deserialize.

targetType Type

The target type to deserialize to.

Returns

object

The deserialized object.

Serialize(object)

Serializes an object to JSON.

string Serialize(object value)

Parameters

value object

The object to serialize.

Returns

string

The JSON string representation.

Serialize(object, bool, JsonSerializerSettings)

Serializes an object to JSON with formatting options.

string Serialize(object value, bool isIndented, JsonSerializerSettings jsonSerializerSettings)

Parameters

value object

The object to serialize.

isIndented bool

Whether to indent the output.

jsonSerializerSettings JsonSerializerSettings

The serializer settings to use.

Returns

string

The JSON string representation.

SerializeT<T>(T)

Serializes a strongly-typed object to JSON.

string SerializeT<T>(T value)

Parameters

value T

The object to serialize.

Returns

string

The JSON string representation.

Type Parameters

T

The type of the object to serialize.

SerializeT<T>(T, bool, JsonSerializerSettings)

Serializes a strongly-typed object to JSON with formatting options.

string SerializeT<T>(T value, bool isIndented, JsonSerializerSettings jsonSerializerSettings)

Parameters

value T

The object to serialize.

isIndented bool

Whether to indent the output.

jsonSerializerSettings JsonSerializerSettings

The serializer settings to use.

Returns

string

The JSON string representation.

Type Parameters

T

The type of the object to serialize.