You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
494 B
18 lines
494 B
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace Common.Util;
|
|
|
|
public class LongJsonConverter : JsonConverter<long>
|
|
{
|
|
public override long Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
|
{
|
|
string? s = reader.GetString();
|
|
return long.Parse(s);
|
|
}
|
|
|
|
public override void Write(Utf8JsonWriter writer, long value, JsonSerializerOptions options)
|
|
{
|
|
writer.WriteStringValue(value.ToString());
|
|
}
|
|
} |