c# - json.net map elements to collection -


i json object looks following.

{     "result": {         "status": 1,         "teams": [             {                 "team_id": 1838315,                 "name": "team secret",                 "tag": "secret",                 "time_created": 1408993713,                 "rating": "inactive",                 "logo": 543025270456493060,                 "logo_sponsor": 540768028333677400,                 "country_code": "",                 "url": "http://www.teamsecret.gg/",                 "games_played_with_current_roster": 0,                 "player_0_account_id": 41231571,                 "player_1_account_id": 73562326,                 "player_2_account_id": 82262664,                 "player_3_account_id": 86745912,                 "player_4_account_id": 87278757,                 "admin_account_id": 5390881,                 "league_id_0": 1803,                 "league_id_1": 1886,                 "league_id_2": 1936,                 "league_id_3": 1942,                 "league_id_4": 2129,                 "league_id_5": 2140,                 "league_id_6": 2158,                 "league_id_7": 2339,                 "league_id_8": 2418,                 "league_id_9": 2661,                 "league_id_10": 2877             }         ]     } } 

i want use newtonsoft json.net libaray deserialize object. of easy not sure how handle player_x_account_id , league_id_x.

both have more or less unlimited amount of elements. not mapped list single elements not sure how map them .net object.

i create hundred members of each sort wouldn't nice. preferable map them sort of collection, have no idea how accomplish or if possible.

any idea how that?

edit: have no control on json object get, it's call steamwebapi

you can use extension data feature of json.net:

public class team {     public int team_id { get; set; }     public string name { get; set; }     public string tag { get; set; }     public string url { get; set; }     //other properties      [jsonextensiondata]     public idictionary<string, jtoken> additionaldata { get; set; } } 

then can check properties league , player ids enumerating additionaldata property.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -