{
"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 I parse it:
string json = e.Result;
var response = JObject.Parse(json);
Debug.WriteLine(response);
var messages_in = new iVk.App.MessagesInStructure[count_messages];
for (int i = 0; i < 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 it doesn’t works..How I can get access to [response][date] and others?
I have error “Cannot access child value on Newtonsoft.Json.Linq.JValue.”
This is wrong:
response[“response”][0] is an integer since the first element in response[“response”] is “50961”, so response[“response”][0][i] is going to fail since you are trying to index something that isnt an array