Thursday, 5 September 2013

Cannot deserialize JSON because the type requires JSON array

Cannot deserialize JSON because the type requires JSON array

I have a List<Book> and I serialize it using Json.NET this way:
return JsonConvert.SerializeObject(value);
value is of type List<Book>
But when I deserialize it get an exception:
return JsonConvert.DeserializeObject<List<Book>>(value);
value is of type string
Error says, cannot deserialize the current JSON object because the types
requires a JSON array

No comments:

Post a Comment