public class MatchingResultDto
{
[DataMember(Name = "id")] public string Id { get; set; }
[DataMember(Name = "entityId")] public Guid EntityId { get; set; }
}
Deserialization throws Unexpected ]
using (var input = new StringReader(result))
{
var deserializedArray = JSON.Deserialize<MatchingResultDto[]>(input, jilOptions);
var deserializedList = JSON.Deserialize<List<MatchingResultDto>>(input, jilOptions); // This fails
var results = deserializedArray?.ToList() ?? new List<MatchingResultDto>();
}
Cannot be deserialized into
Deserialization throws
Unexpected ]
But Array serialization works.