I'm new on C# and I don't know how can I work with json file. I want that my script search on json file on my site but I don't know how can I create class that work with that file. This is my json file
{
"Name 1": [
{
"license_on":true,
"webhook":"Discord Webhook",
"serverName": "Server Name",
"idDiscord": "Discord ID",
"discordName": "Serse Dio Re",
"ipAllowed": "IP allowed to use the script",
"license": "License"
}
],
"Name 2": [
{
"license_on":true,
"webhook":"Discord Webhook",
"serverName": "Server Name",
"idDiscord": "Discord ID",
"discordName": "Serse Dio Re",
"ipAllowed": "IP allowed to use the script",
"license": "License"
}
]
}
I want that when the resource is started, check from the site first if there is the name of the server that assigns it as a variable, if it exists it must print all the data only from that server, for example if there is Name 1 I only get the characteristics of the Name 1. This is my initial code in c #
public static void ReadSite()
{
try
{
string site = "My Site where json file";
WebClient wc = new WebClient();
string data = wc.DownloadString(site);
// some code
}
catch(Exception e)
{
Console.WriteLine($"{e.Message}");
Console.WriteLine($"{e.GetType()}");
Console.ReadLine();
}
}
Please I need a class and an explanation of how to work with it. Thank you