So... I got these two following classes for json file
public class Scorebot
{
public string Messagedata { get; set; }
public string CurrentScoreCt { get; set; }
public string CurrentScoreT { get; set; }
public string TeamNameCt { get; set; }
public string TeamNameT { get; set; }
public Players[] PlayersCt { get; set; }
public Players[] PlayersT { get; set; }
}
public class Players
{
public string Nickname { get; set; }
public string Weapon { get; set; }
public string Health { get; set; }
public string Armor { get; set; }
public string Money { get; set; }
public string Adr { get; set; }
public string Kills { get; set; }
public string Assists { get; set; }
public string Deaths { get; set; }
}
the following json should looking like:
{
"messagedata": "kyoto killed SEGADOBR",
"currentscoreCT": "10",
"currentscoreT": "10",
"teamnameCT": "CT",
"teamnameT": "T",
"playersCT": [
{
"Nickname": "SEGADOBR",
"Weapon": "ak47",
"Health": "100",
"Armor": "100",
"Money": "16000",
"ADR": "13.6",
"Kills": "16",
"Assists": "5",
"Deaths": "18"
}
],
"playersT": [
{
"Nickname": "kyoto",
"Weapon": "ak47",
"Health": "100",
"Armor": "100",
"Money": "16000",
"ADR": "13.6",
"Kills": "999",
"Assists": "5",
"Deaths": "18"
}
]
}
How to access variables (Messagedata, CurrentScoreCt, CurrentScoreT, TeamNameCt and TeamNameT) i understood. But what i should do to fill elements in this (Players[] PlayersCt, Players[] PlayersT), how to access them correctly?
As i understand it should look like this
Scorebot.PlayersCt[i].Nickname = "something"
But it didn't work. How to do it?