Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SystemTextJsonSerializer.cs « Serializers « SerializerBenchmark « benchmark - github.com/aspnet/MessagePack-CSharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f6358d1546ed4862a4e4033e488bad84fe15db7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Copyright (c) All contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Benchmark.Serializers;

#pragma warning disable SA1649 // File name should match first type name

public class SystemTextJson : SerializerBase
{
    public override object Serialize<T>(T input)
    {
        return System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(input);
    }

    public override T Deserialize<T>(object input)
    {
        var span = (byte[])input;
        return System.Text.Json.JsonSerializer.Deserialize<T>(span);
    }
}