I am using the new System.Text.Json in asp.net core and I noticed that the grid does not bind to the model when using the new .net Core Json library. If I use Newtonsoft.Json the bind binding works fine.
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(IISDefaults.AuthenticationScheme);
services.AddKendo();
services.AddControllersWithViews();
//.AddNewtonsoftJson(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver());
}
@(Html.Kendo().Grid<TestModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(e => e.email);
columns.Bound(e => e.username);
})
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(100)
.Read(read => read.Action("Read", "home"))
)
)
Model
public class TestModel
{
public string archiveGuid { get; set; }
public string orgUid { get; set; }
public string orgName { get; set; }
public string orgExtRef { get; set; }
public string userUid { get; set; }
public string username { get; set; }
public string email { get; set; }
}
Here is what is returned with NewtonSoft JSON. I also noticed that D in the data response sent is capitalized when using Newtonsoft.json. Any ideas? It could be due to the contract resolver not being set when we are using the System.Text.Json as posted here https://www.telerik.com/forums/grid---binding-doesn't-work but I don't think there is a contract resolver option for the System.Text.Json.