Start Debugging
2023-09-07 Updated 2023-11-12 csharpdotnetdotnet-8

.NET 8 – Serialization of Half, Int128, and UInt128

System.Text.Json in .NET 8 adds built-in serialization support for the Half, Int128, and UInt128 numeric types.

System.Text.Json brings out of the box support for additional types:

Let’s look at an example:

Console.WriteLine(JsonSerializer.Serialize(Half.MaxValue));
// Output: 65500

Console.WriteLine(JsonSerializer.Serialize(Int128.MaxValue));
// Output: 170141183460469231731687303715884105727

Console.WriteLine(JsonSerializer.Serialize(UInt128.MaxValue));
// Output: 340282366920938463463374607431768211455
< Back