c# - Newtonsoft Array With Index Key Deserialize -


i use newtonsoft.net library deserialize/serialize objects.

could deserialize following json array of "offerpixel" ?

all of arrays has index number each item on service. "offerpixel" object seem subitem of index number.

{ "data": {       "1": {         "offerpixel": {           "id": "1",           "affiliate_id": "1009",           "offer_id": "7",           "status": "deleted",           "code": "",           "type": "url",           "modified": "2012-02-16 10:07:33",           "goal_id": null         }       },       "2": {         "offerpixel": {           "id": "2",           "affiliate_id": "1011",           "offer_id": "7",           "status": "deleted",           "code": "",           "type": "code",           "modified": "2013-08-16 07:27:20",           "goal_id": null         }       },       "3": {         "offerpixel": {           "id": "3",           "affiliate_id": "1010",           "offer_id": "7",           "status": "deleted",           "code": "",           "type": "image",           "modified": "2013-01-31 12:01:57",           "goal_id": null         }        },     "errors": [],     "errormessage": null   } } 

using json.net

var list = jobject.parse(json)                     .descendants()                     .oftype<jproperty>()                     .where(p => p.name == "offerpixel")                     .select(x => x.value.toobject<offerpixel>())                     .tolist(); 

public class offerpixel {     public string id { get; set; }     public string affiliate_id { get; set; }     public string offer_id { get; set; }     public string status { get; set; }     public string code { get; set; }     public string type { get; set; }     public string modified { get; set; }     public object goal_id { get; set; } } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -