System Library Common Framework
Search Results for

    *.Benchmark*,*.Tests*,*.ApiTests*,*.BaseTest*,DelegateJsonConverter,CalleeCancelledRequestException,ClientResponse,ContentType,OutputCachePolicy
    Show / Hide Table of Contents Show / Hide Table of Contents
    NamespaceSystemLibrary.Common.Framework.Attributes SystemLibrary.Common.Framework.Json.dll

    Compress and decompress a String, Long or Int property or field on serialization and deserialization

    Useful when you want to minify long texts before sending to Client or upon receiving

    Remarks
    X

    Does not support all property/field types, but at least supports: int, int16, uint, int64, uint64 and string types

    JsonCompressAttribute

    [AttributeUsage(AttributeTargets.Property|AttributeTargets.Field)] public class JsonCompressAttribute : JsonConverterAttribute

    Inheritance
    object
    Attribute
    JsonAttribute
    JsonConverterAttribute
    JsonCompressAttribute
    Inherited Members
    JsonConverterAttribute.ConverterType
    Examples
    X

    Model.cs:

    class Model
    {
        // Value is compressed upon serialization (stringify) and decompressed on deserialization (objectify)
        [JsonCompress]
        public string Token {get;set;} 
    
        [JsonCompress]
        public long ProductId {get;set;}
    }
    Arguments
    X

    Constructors

    Compress and decompress a String, Long or Int property or field on serialization and deserialization

    Useful when you want to minify long texts before sending to Client or upon receiving

    Remarks
    X

    Does not support all property/field types, but at least supports: int, int16, uint, int64, uint64 and string types

    public JsonCompressAttribute()

    X

    Model.cs:

    class Model
    {
        // Value is compressed upon serialization (stringify) and decompressed on deserialization (objectify)
        [JsonCompress]
        public string Token {get;set;} 
    
        [JsonCompress]
        public long ProductId {get;set;}
    }
    X

    Methods

    When overridden in a derived class and ConverterType is null, allows the derived class to create a JsonConverter in order to pass additional state.

    Remarks
    X

    Does not support all property/field types, but at least supports: int, int16, uint, int64, uint64 and string types

    public override JsonConverter CreateConverter(Type typeToConvert)

    X
    Methods arguments
    Type Name Description
    Type typeToConvert

    The type of the converter.

    X
    Type Description
    JsonConverter

    The custom converter.

    Overrides
    JsonConverterAttribute.CreateConverter(Type)

    Extension Methods

    ObjectExtensions.Json(object, bool)
    ObjectExtensions.Json(object, JsonSerializerOptions, bool, params JsonConverter[])
    ObjectExtensions.Json(object, params JsonConverter[])
    ObjectExtensions.Xml(object)

    }

    In This Article
    Package: nuget
    Source: github
    Website: System Library Common Framework