Dealing with JSON data is a pretty standard use case in modern application development and .NET applications are no exception. When compared to XML data type which apparently has built-in support with lot of libraries and interfaces in .NET Framework. Remember, LINQ to XML which gives in-memory LINQ query interface over XML data source. Strangely, there is no LINQ to JSON. It is quite clear that .NET had lagged historically in providing similar level of treatment to JSON data type in .NET framework. Of course, There are classes like
Enter the new System.Text.Json API
Microsoft announced recently they’re shipping brand new assembly
System.Text.JSON with .NET Core 3 preview release. The new API offers better performance over Json.NET as evidenced in the benchmark tests. It aims to remove tighter Json.NET dependency from ASP.NET Core. For Json.NET lovers, ASP.NET Core is giving alternate Json.NET integration via
AddJsonOptions extension method. New API is fully supported in ASP.NET Core and SignalR. Please note new API has further work to do. Support for Open API/Swagger is ongoing and field serialization is not supported yet.
For full in-depth details on new System.Text.Json API, please see this excellent article. There is also a channel 9 video which walks through new JSON Api