I'm trying to migrate from JavaScriptSerializer to System.Text.Json and I see that the latter doesn't understand serialized data from the former. Newtonsoft understands the format but I need System.Text.Json. How can I workaround it? What other snags can I hit?
var str = "{ \"Date\": \"\\/Date(1471463788903)\\/\" }";
var js = new JavaScriptSerializer().Deserialize<D>(str);
var newntonsoft = JsonConvert.DeserializeObject<D>(str);
var system = JsonSerializer.Deserialize<D>(str); // throws
public class D { public DateTime Date { get; set; } }
System.Text.Json. There are however custom converters available that do support the Microsoft date format.System.Text.Jsonallows you to write yourself.I'm not allowed to use third-party packageshallmark of an insane employer.