.Net Core 3.0 native Json parser

Microsoft's official blog describes why the construction of a new Json parser rather than continue to use industry guidelines Json.Net

Microsoft blog address: https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/

In the official Github, but also a detailed description of this problem: https://github.com/dotnet/corefx/issues/33115

There is briefly described a .Net Core Span <T> class, which is similar to the array, but it is not hosted heap, thus providing a high-performance memory operation, which will serialization and deserialization provide higher performance .

At the same time a point UTF-8 and UTF-16 is Microsoft considered.

I began to learn more about it:

  

    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            string person = "[{\"name\":\"fanqi\",\"age\":25,\"phone\":[\"10086\",\"10010\"]},{\"name\":\"zhangrong\",\"age\":24,\"phone\":[\"10000\",\"10010\"]}]";
            List<Person> personList = JsonSerializer.Deserialize<List<Person>>(person);
            string json = JsonSerializer.Serialize(personList, personList.GetType());
            JsonDocument document = JsonDocument.Parse(person);
            Console.ReadKey();

        }
    }
    class Person
    {
        public string name { get; set; }
        public int? age { get; set; }
        public List<string> phone { get; set; }
    }

 

Guess you like

Origin www.cnblogs.com/fanqisoft/p/11479193.html