От сервера получаю такой Json ответ:
{
"msg": "",
"code": 0,
"data": {
"activities": [],
"num_public_wishes": 32,
"no_more": true,
"create_new_bucket": true,
"bucket_data": [{
"modifiable_by_user": true,
"private": false,
"permalink": "There is permalink",
"name": "Saved",
"editable_by_user": true,
"bid": "57e223429eb552528256b4e9",
"preview": [{
"id": "5667994c86d126439ab55ff7",
"img": "There is img"
}, {
"id": "55457d60f4b60f0c2f6d02ab",
"img": "There is img"
}, {
"id": "5690b999e0024d483bc9369a",
"img": "There is img"
}, {
"id": "5643fa9c3d35b7435c7a226f",
"img": "There is img"
}, {
"id": "545907735f313f5bf24fde18",
"img": "There is img"
}, {
"id": "55ffa3dc3fffcd10f76e2846",
"img": "There is img"
}, {
"id": "56ff955db96d205cf08a4686",
"img": "There is img"
}, {
"id": "56c1a8a51eab250fbf4380ea",
"img": "There is img"
}, {
"id": "563881536d72217ae8089ad3",
"img": "There is img"
}],
"type": "product",
"set_id": "57e223429eb552528256b4e9",
"size": 28
}, {
"modifiable_by_user": true,
"private": false,
"permalink": "There is permalink",
"name": "Tenues Coquines",
"editable_by_user": true,
"bid": "581f156487c0530d34d26228",
"preview": [{
"id": "53e1cdd2ff4d6d7bdfe7282c",
"img": "There is img"
}],
"type": "product",
"set_id": "581f156487c0530d34d26228",
"size": 4
}, {
"modifiable_by_user": true,
"private": false,
"permalink": "There is permalink",
"name": "Sauvegard\u00e9 pour plus tard",
"editable_by_user": true,
"bid": "5909e5d193c007f3df39b705",
"preview": [],
"type": "product",
"set_id": "5909e5d193c007f3df39b705",
"size": 0
}, {
"modifiable_by_user": false,
"name": "\u041f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0438",
"editable_by_user": false,
"bid": "users_followers",
"preview": [],
"type": "user.followers",
"set_id": "follower:57e221c945ac3583926296eb",
"size": 0
}, {
"modifiable_by_user": false,
"name": "\u041f\u043e\u0434\u043f\u0438\u0441\u043a\u0438",
"editable_by_user": false,
"bid": "user_following",
"preview": [],
"type": "user.following",
"set_id": "following:57e221c945ac3583926296eb",
"size": 0
}],
"body_id": "new-profile-page",
"is_following": false,
"user": {
"short_name": "There is short name",
"locale": "ru",
"has_profile_pic": false,
"is_admin": false,
"is_fb_user": false,
"country_code": "RU",
"gender": "male",
"id": "57e221c945ac3583926296eb",
"fb_uid": "100006517987800",
"signup_date": "2016-09-21T05:59:37+00:00",
"name": "There is Name",
"is_wish_employee": false,
"is_wish_star": false,
"profile_pic_medium": "There is profile pic medium",
"profile_pic_small": "There is profile pic small",
"is_temporary": false,
"profile_pic_large": "There is url for profile pic large",
"email": "There is email"
},
"num_added": 0,
"num_gift_cards": 0,
"num_following": 0,
"personal_tags": null,
"num_followers": 0,
"primary_view": true,
"birthday_banner": null,
"state": "registered",
"next_offset": 2,
"fb_third_party_id": null,
"num_rewards": 0,
"preview_size": 9,
"num_wishes": 32
},
"sweeper_uuid": "208ec5179a5d4cb0a5a6db1395aabe22"
}
Пытаюсь парсить с помощью Newtonsoft.Json, сгенерировал такие классы по json ответу:
public class BucketData
{
public bool modifiable_by_user { get; set; }
public bool @private { get; set; }
public string permalink { get; set; }
public string name { get; set; }
public bool editable_by_user { get; set; }
public string bid { get; set; }
public List<object> preview { get; set; }
public string type { get; set; }
public string set_id { get; set; }
public int size { get; set; }
}
public class User
{
public string short_name { get; set; }
public string locale { get; set; }
public bool has_profile_pic { get; set; }
public bool is_admin { get; set; }
public bool is_fb_user { get; set; }
public string country_code { get; set; }
public string gender { get; set; }
public string id { get; set; }
public string fb_uid { get; set; }
public DateTime signup_date { get; set; }
public string name { get; set; }
public bool is_wish_employee { get; set; }
public bool is_wish_star { get; set; }
public string profile_pic_medium { get; set; }
public string profile_pic_small { get; set; }
public bool is_temporary { get; set; }
public string profile_pic_large { get; set; }
public string email { get; set; }
}
public class Data
{
public List<object> activities { get; set; }
public int num_public_wishes { get; set; }
public bool no_more { get; set; }
public bool create_new_bucket { get; set; }
public List<BucketData> bucket_data { get; set; }
public string body_id { get; set; }
public bool is_following { get; set; }
public User user { get; set; }
public int num_added { get; set; }
public int num_gift_cards { get; set; }
public int num_following { get; set; }
public object personal_tags { get; set; }
public int num_followers { get; set; }
public bool primary_view { get; set; }
public object birthday_banner { get; set; }
public string state { get; set; }
public int next_offset { get; set; }
public object fb_third_party_id { get; set; }
public int num_rewards { get; set; }
public int preview_size { get; set; }
public int num_wishes { get; set; }
}
public class RootObject
{
public string msg { get; set; }
public int code { get; set; }
public Data data { get; set; }
public string sweeper_uuid { get; set; }
}
Например десереализирую:
var des = JsonConvert.DeserializeObject<User>(request.Response.ToString());
MessageBox.Show(des.country_code);
Но получаю неизвестно почему пустой MessageBox. Помогите, пожалуйста. Уже который час не могу понять почему так. Спасибо!