Im getting a Json Data from an API and i have been trying to deserialize.
Json data:
{
\"items\": [
{
\"id\": \"1\",
\"nam
Your entities(models) look just fine. If you are using, or were to use ASP.NET Web API 2, and your client is using the http verb post for example, this setup would work as Web API takes care of the object deserialization:
public HttpStatusCode Post(Item item)
{
Debug.Write(item.toString());
return HttpStatusCode.OK;
}
If you insist in deserializing manually then use the JavaScriptSerializer library which allows you to do things like:
Item item = new JavaScriptSerializer().Deserialize- (content);
Notice that .Deserialize
takes a generic which in your case it Item
.
Hope that helps.