I'm currently using Microsoft.AspNet.WebApi.Client 5.0.0 which includes Newtonsoft.Json 4.5.11. My solution is in VS 2012 and .Net 4.5. I'm making a REST call to Box.com (External call... I have no control over the json content). From the following (trimmed-down) response Json, I want to deserialize the "entries" array into strongly typed "folder" and "file" objects, based on the value of the "type" property in the response. I'm trying to avoid any custom conversion. Is there a straight forward way to do this, perhaps with attributes? I feel I'm missing something simple.
{
"total_count" : 2,
"entries" : [{
"type" : "folder",
"id" : "12345678",
"sequence_id" : "2",
"etag" : "2",
"name" : "Some Folder",
},
{
"type" : "file",
"id" : "4324348834",
"sequence_id" : "8",
"etag" : "8",
"sha1" : "134324329e9k93kdieoikek",
"name" : "Testing.xlsx",
"description" : "",
"item_status" : "active"
}
],
"limit" : 30,
"offset" : 0
}