"{\"id\":20,\"Title\":\"Parti 8\",\"Description\":\"Parti ve daha çok parti iste bu açikalamada, bilmeyenler anlamaz dedigimiz bir parti ve parti iste budur o parti\",\"StartTime\":\"2015-11-04T21:00:00\",\"EndTime\":\"2015-12-04T01:00:00\",\"State\":0}"
I have this json string which had been serialized by
JsonConvert.SerializeObject()
But when I try to deserialize it with
Newtonsoft.Json.JsonConvert.DeserializeObject<Party>(JSON)
I get this exception
Newtonsoft.Json.JsonSerializationException: Error converting value "{"id":20,"Title":"Parti 8","Description":"Parti ve daha çok parti iste bu açikalamada, bilmeyenler anlamaz dedigimiz bir parti ve parti iste budur o parti","StartTime":"2015-11-04T21:00:00","EndTime":"2015-12-04T01:00:00","State":0}" to type 'PMApp.Models.Party'. Path '', line 1, position 254.
And here is the Party Entity
public class Party
{
[JsonProperty(PropertyName="id")]
public int id { get; set; }
[JsonProperty(PropertyName = "Title")]
public string Title { get; set; }
[JsonProperty(PropertyName = "Description")]
public string Description { get; set; }
[JsonProperty(PropertyName = "StartTime")]
public DateTime StartTime { get; set; }
[JsonProperty(PropertyName = "EndTime")]
public DateTime EndTime { get; set; }
[JsonProperty(PropertyName = "State")]
public int State { get; set; }
}
Edit
var result = response.Content.ReadAsStringAsync().Result;
"\"{\\\"id\\\":20,\\\"Title\\\":\\\"Parti 8\\\",\\\"Description\\\":\\\"Parti ve daha cok parti iste bu acikalamada, bilmeyenler anlamaz dedigimiz bir parti ve parti iste budur o parti\\\",\\\"StartTime\\\":\\\"2015-11-04T21:00:00\\\",\\\"EndTime\\\":\\\"2015-12-04T01:00:00\\\",\\\"State\\\":0,\\\"Place\\\":{\\\"id\\\":14,\\\"Title\\\":\\\"Novo\\\",\\\"Address\\\":\\\"Sofyalı Sok. No:3 Beyoğlu Asmalı Mescit \\\",\\\"PhoneNumber\\\":\\\"0212 2525952\\\",\\\"Genres\\\":null,\\\"Parties\\\":null}}\""
When I debug this is the result string. When I copied the the text directly from the exception it worked fine. I tried the replace the backslashes but it did not worked. Any ideas?