c# - How to get acces to json.net array? -


{   "response": [     50961,     {       "mid": 148014,       "date": 1309642994,       "out": 0,       "uid": 39050402,       "read_state": 1,       "title": " ... ",       "body": "здоров"     },     {       "mid": 148012,       "date": 1309641130,       "out": 0,       "uid": 56015000,       "read_state": 1,       "title": "...",       "body": ")"     },     {       "mid": 148010,       "date": 1309639892,       "out": 0,       "uid": 56015000,       "read_state": 1,       "title": " ... ",       "body": "Привет)"     }, 

how parse it:

string json = e.result; var response = jobject.parse(json); debug.writeline(response); var messages_in = new ivk.app.messagesinstructure[count_messages]; (int = 0; < count_messages; i++) {     messages_in[i].readstate = convert.toboolean(response["response"][i]["read_state"]);     messages_in[i].text = response["response"][i]["body"].tostring();     messages_in[i].otpravitel = response["response"][i]["uid"].tostring();     messages_in[i].date_time = convert.todatetime(response["response"][0][i]["date"]); } 

but nothing of doesn't works..how can access [response][date] , others? have error "cannot access child value on newtonsoft.json.linq.jvalue."

this wrong:

convert.todatetime(response["response"][0][i]["date"]); 

response["response"][0] integer since first element in response["response"] "50961", response["response"][0][i] going fail since trying index isnt array


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -