[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IJsonSerializer.Serialize

Serialize Method

Serialize(object)

Serializes an object to a JSON string.

Implement this method to convert a custom value into JSON text that can be used during JSON import and export. The returned string should be compatible with the corresponding Deserialize(string) implementation.

Declaration
string Serialize(object value)
Function Serialize(value As Object) As String
Parameters
Type Name Description
object value

The object to serialize. null handling is implementation-defined.

Returns
Type Description
string

The JSON string representation of the object.

Examples
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();
string json = serializer.Serialize("A");