I have this segment of a JSON file:
[
{"Name": "Chelsea",
"GoalDiff": 20,
"Points": 25
},
{"Name": "Liverpool",
"GoalDiff": 30,
"Points": 35
},
{"Name": "Man United",
"GoalDiff": 5,
"Points": 18
}
]
I need to put these into an array per object, where I can easily access them to sort, use as variables, and put into a formula.
EDIT:
I have tried some things from this site to just read the file, with little success for example
class Program
{
public class TeamInfo
{
public string Name {get; set;}
public int GoalDiff {get; set;}
public int points { get; set; }
}
public void LoadJson()
{
using(StreamReader r = new StreamReader("TXT1.json"))
{
string json = r.ReadToEnd();
List<TeamInfo> items = JsonConvert.DeserializeObject<List<TeamInfo>>(json);
}
}
static void Main(string[] args)
{
dynamic array = JsonConvert.DeserializeObject(json);
foreach (var item in array)
{
Console.WriteLine(item.temp, item.vcc)
}
}
}
Similarly the newtonsoft website didn't help me a whole load.