Merge pull request #3898 from crobibero/fix-int64

Return int64 in json as number
pull/3536/head^2
Bond-009 5 years ago committed by GitHub
commit af78b9c2e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,7 +8,7 @@ using System.Text.Json.Serialization;
namespace MediaBrowser.Common.Json.Converters namespace MediaBrowser.Common.Json.Converters
{ {
/// <summary> /// <summary>
/// Long to String JSON converter. /// Parse JSON string as long.
/// Javascript does not support 64-bit integers. /// Javascript does not support 64-bit integers.
/// </summary> /// </summary>
public class JsonInt64Converter : JsonConverter<long> public class JsonInt64Converter : JsonConverter<long>
@ -43,14 +43,14 @@ namespace MediaBrowser.Common.Json.Converters
} }
/// <summary> /// <summary>
/// Write long to JSON string. /// Write long to JSON long.
/// </summary> /// </summary>
/// <param name="writer"><see cref="Utf8JsonWriter"/>.</param> /// <param name="writer"><see cref="Utf8JsonWriter"/>.</param>
/// <param name="value">Value to write.</param> /// <param name="value">Value to write.</param>
/// <param name="options">Options.</param> /// <param name="options">Options.</param>
public override void Write(Utf8JsonWriter writer, long value, JsonSerializerOptions options) public override void Write(Utf8JsonWriter writer, long value, JsonSerializerOptions options)
{ {
writer.WriteStringValue(value.ToString(NumberFormatInfo.InvariantInfo)); writer.WriteNumberValue(value);
} }
} }
} }

Loading…
Cancel
Save