Reputation: 19063
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; } }
Upvotes: 1
Views: 989