Get json data in C# -


i have json need value json in c# language. got data json creating class , work. when use same way value json there have error appear. error :

'string' not contain definition 'data' 

i not sure mistake. how value json , supposedly work. class:

public class instacomments {     public data[] data { get; set; }     public class data     {         public string created_time { get; set; }         public string text { get; set; }         public string full_name { get; set; }     } } 

and error appear @ line of code:

list dyn = jsonconvert.deserializeobject>(resultcomments.data.tostring());//error on here 

this json code:

"{\"meta\":{\"code\":200},\"data\":{\"created_time\":\"1406056452\",\"text\":\"cool!\",\"from\":{\"username\":\"s19xx_\",\"profile_picture\":\"http:\\/\\/photos-d.ak.instagram.com\\/hphotos-ak-xaf1\\/10499142_1462797113973499_926138390_a.jpg\",\"id\":\"445755252\",\"full_name\":\"\\ud83d\\udc97\"},\"id\":\"770379817908166709\"},{\"created_time\":\"1406423741\",\"text\":\"nice pic!\",\"from\":{\"username\":\"zaffique\",\"profile_picture\":\"http:\\/\\/images.ak.instagram.com\\/profiles\\/profile_143827767_75sq_1378666562.jpg\",\"id\":\"143827767\",\"full_name\":\"chaperone molecule\\u2122\"},\"id\":\"773460860856951112\"},{\"created_time\":\"1406466052\",\"text\":\"@zaffique yeahhh\",\"from\":{\"username\":\"anakshawal\",\"profile_picture\":\"http:\\/\\/photos-g.ak.instagram.com\\/hphotos-ak-xaf1\\/10584712_1532798830282582_253819990_a.jpg\",\"id\":\"22545759\",\"full_name\":\"\"},\"id\":\"773815792877429301\"},{\"created_time\":\"1406509023\",\"text\":\"good shot!\",\"from\":{\"username\":\"c_uniqueroom\",\"profile_picture\":\"http:\\/\\/photos-e.ak.instagram.com\\/hphotos-ak-xfp1\\/10547229_328439730654500_459648312_a.jpg\",\"id\":\"456088491\",\"full_name\":\"c_uniqueroom\"},\"id\":\"774176262612312566\"},{\"created_time\":\"1408277876\",\"text\":\"lol\",\"from\":{\"username\":\"adieruddinwanahmad\",\"profile_picture\":\"http:\\/\\/photos-e.ak.instagram.com\\/hphotos-ak-xpa1\\/10471808_1459922647581324_961927518_a.jpg\",\"id\":\"355537664\",\"full_name\":\"wan adieruddin wan ahmad\"},\"id\":\"789014471007527397\"},{\"created_time\":\"1408279167\",\"text\":\"@adieruddinwanahmad there\",\"from\":{\"username\":\"anakshawal\",\"profile_picture\":\"http:\\/\\/photos-g.ak.instagram.com\\/hphotos-ak-xaf1\\/10584712_1532798830282582_253819990_a.jpg\",\"id\":\"22545759\",\"full_name\":\"\"},\"id\":\"789025304592769150\"},{\"created_time\":\"1408310569\",\"text\":\"please @anakshawal  can distressed situation badly guy\",\"from\":{\"username\":\"adieruddinwanahmad\",\"profile_picture\":\"http:\\/\\/photos-e.ak.instagram.com\\/hphotos-ak-xpa1\\/10471808_1459922647581324_961927518_a.jpg\",\"id\":\"355537664\",\"full_name\":\"wan adieruddin wan ahmad\"},\"id\":\"789288719299108925\"}]}" 

please tell me mistake. in advance.

from of it, json isn't json, it's string parsed json.

to using same data source, you'd need de-serialise twice. once string , time json string.

a better way whatever sending json not enclose in string. may simple not calling .tostring on resultcomments.data, it's more source of data accidently turning json single string.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -