Version 1.1.8

Date 2019-01-20 (2,132 days ago)
Downloads 1,823 downloads
NuGet View on NuGet
GitHub View on GitHub
Target Frameworks .NET Standard 1.1 .NET Standard 1.3 .NET 4.5 .NET 4.6 .NET 4.7

#installation">Installation

#changelog">Changelog

  • Introduced new EnumStringConverter JSON converter class to replace existing converters. The classes EnumPascalCaseConverter, EnumLowerCaseConverter and EnumCamelCaseConverter have now been marked as obsolete.

    The new converter works by specifying the format to be used when serializing to JSON - eg. by decorating the property with an attribute like:

    [JsonConverter(typeof(EnumStringConverter), TextCasing.KebabCase)]
    public HttpStatusCode StatusCode { get; set; }
    

    Supported formats are (default is TextCasing.PascalCase):

    • TextCasing.LowerCase
    • TextCasing.UpperCase
    • TextCasing.CamelCase
    • TextCasing.PascalCase
    • TextCasing.KebabCase
    • TextCasing.TrainCase
    • TextCasing.Underscore
  • Introduced new TimeConverter JSON converter class. Besides providing new functionality, the new converter also replaces EssentialsDateTimeConverter and UnixTimeConverter.

    The new converter can be used by adding the following attribute on the property:

    [JsonConverter(typeof(TimeConverter), TimeFormat.Iso8601)]
    public DateTime Time { get; set; }
    

    Supported formats are (default is TimeFormat.Iso8601):

    • TimeFormat.Iso8601
    • TimeFormat.Rfc822
    • TimeFormat.Rfc2822
    • TimeFormat.UnixTime

    TimeConverter is now the default JSON converter for EssentialsDateTime and EssentialsTime.