[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.Workbook.TagJsonSerializer

TagJsonSerializer Property

TagJsonSerializer

Gets or sets the json serializer/deserializer for custom type.

Declaration
public static IJsonSerializer TagJsonSerializer { get; set; }
Public Shared Property TagJsonSerializer As IJsonSerializer
Examples
class ValueWithUnit
{
    public double Amount;
    public string Unit;
}

class ValueSerializer : IJsonSerializer
{
    public string Serialize(object value)
    {
        ValueWithUnit data = (ValueWithUnit)value;
        return Newtonsoft.Json.JsonConvert.SerializeObject(data);
    }

    public object Deserialize(string json)
    {
        return Newtonsoft.Json.JsonConvert.DeserializeObject<ValueWithUnit>(json);
    }
}

IJsonSerializer serializer = new ValueSerializer();
Workbook.TagJsonSerializer = serializer;
IJsonSerializer currentSerializer = Workbook.TagJsonSerializer;