Answer the question
In order to leave comments, you need to log in
How to deserialize empty Guid array using Newtonsoft deserializer?
I get data from the API and try to deserialize it into a list of objects, but the deserialization fails. ErrorMessage: No parameterless constructor defined for type 'System.Guid[]'. How can I fix this MissingMethodException? Where can I add this empty constructor?
Answer the question
In order to leave comments, you need to log in
What version of Newtonsoft are you using?
On .NET 5 and Newtonsoft.Json/13.0.1 everything is ok.
#r "nuget:Newtonsoft.Json/13.0.1"
var guids = Newtonsoft.Json.JsonConvert.DeserializeObject<Guid[]>("[]").Dump();
var guids2 = System.Text.Json.JsonSerializer.Deserialize<Guid[]>("[]").Dump();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question