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 SystemLibrary.Common.Framework.Json.dll

    Use to convert a string to DateTime during Json() invocation with your own format

    Remarks
    X

    Used internally Exposed if someone needs a different format that this Library does not support out of the box when using Json() extension method

    DateTimeJsonConverter

    public class DateTimeJsonConverter : JsonConverter<DateTime>

    Inheritance
    object
    JsonConverter
    JsonConverter<DateTime>
    DateTimeJsonConverter
    Inherited Members
    JsonConverter<DateTime>.CanConvert(Type)
    JsonConverter<DateTime>.ReadAsPropertyName(ref Utf8JsonReader, Type, JsonSerializerOptions)
    JsonConverter<DateTime>.WriteAsPropertyName(Utf8JsonWriter, DateTime, JsonSerializerOptions)
    JsonConverter<DateTime>.HandleNull
    JsonConverter<DateTime>.Type
    Examples
    X

    Example:

    var options = new JsonSerializationOptions();
    options.Converters.Add(new DateTimeJsonConverter("yyyy/MM/dd hh:mm"));
    
    // Assume "json" is a string and somewhere there's a date on format "2000/12/24 12:30"
    var result = json.Json(options);
    Arguments
    X

    Constructors

    Use to convert a string to DateTime during Json() invocation with your own format

    Remarks
    X

    Used internally Exposed if someone needs a different format that this Library does not support out of the box when using Json() extension method

    public DateTimeJsonConverter(string format = null)

    X

    Example:

    var options = new JsonSerializationOptions();
    options.Converters.Add(new DateTimeJsonConverter("yyyy/MM/dd hh:mm"));
    
    // Assume "json" is a string and somewhere there's a date on format "2000/12/24 12:30"
    var result = json.Json(options);
    X
    Methods arguments
    Type Name Description
    string format

    Methods

    Reads and converts the JSON to type DateTime.

    Remarks
    X

    Used internally Exposed if someone needs a different format that this Library does not support out of the box when using Json() extension method

    public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

    X
    Methods arguments
    Type Name Description
    Utf8JsonReader reader

    The reader.

    Type typeToConvert

    The type to convert.

    JsonSerializerOptions options

    An object that specifies serialization options to use.

    X
    Type Description
    DateTime

    The converted value.

    Overrides
    JsonConverter<DateTime>.Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

    Writes a specified value as JSON.

    Remarks
    X

    Used internally Exposed if someone needs a different format that this Library does not support out of the box when using Json() extension method

    public override void Write(Utf8JsonWriter writer, DateTime date, JsonSerializerOptions options)

    X
    Methods arguments
    Type Name Description
    Utf8JsonWriter writer

    The writer to write to.

    DateTime date
    JsonSerializerOptions options

    An object that specifies serialization options to use.

    Overrides
    JsonConverter<DateTime>.Write(Utf8JsonWriter, DateTime, JsonSerializerOptions)

    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