Does Radzen Upload/Download components support System.Text.Json

Hello,

Does Radzen Upload/Download components support System.Text.Json for serialization and deserialization? Newtonsoft works but trying to convert to System.Text.Json. When I try to deserialize all the properties come back null. Any thoughts?

Raw Response

{"fileName":"Test.txt","fileBytes":"ODAwLTMzMS0zNDI1DQpBUkFHIElEIGlzIDIwODQxNjE3OTY1Ng0KDQpDaGFybGVzIFlvdHQNCkVJTiAjIDI1NzEzOQ0KDQpGYW1pbHkgTGF3IEF0dG9ybmV5DQpaaXAgMzA1OTcNCg0KOCBob3VycyAtIDIwJSBkaXNjb3VudA==","fileType":null}

public class UploadFileResponseModel
{
public string? FileName { get; set; }
public byte? FileBytes { get; set; }
public string? FileType { get; set; }
}

protected async Task Completed(UploadCompleteEventArgs args)
{
try
{
//var uploadResponse = JsonConvert.DeserializeObject(args.RawResponse);
var uploadResponse = JsonSerializer.Deserialize(args.RawResponse);

Ok, I missed adding a property to make it case insensitive. This fixes the issue for anyone else having the problem.

var uploadResponse = JsonSerializer.Deserialize(args.RawResponse, new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true,
});

1 Like