I'm trying to read JSON file from the my local folder and create objects send it to view and also trying to read the json file and create the classes dynamically (i.e I want to create class after based on json file what I get I searched a lot about it somebody please help) my json
{
"Dev": {
"resourcegroup": "devusemap",
"storageaccount": "devusemdapstorage",
"azuresqlserver": "azuresqlserver",
"container": "container",
"sourcesqlserver": "sourcesqlserver"
},
"qa": {
"resourcegroup": "qavusemap",
"storageaccount": "qavusemdapstorage",
"azuresqlserver": "azuresqlserver",
"container": "container",
"sourcesqlserver": "sourcesqlserver"
}
}
my class
public class Environmet
{
public string Name { get; set; }
Env_properties prop { get; set; }
}
public class Env_properties
{
public string resourcegroup { get; set; }
public string storageaccount { get; set; }
public string azuresqlserver { get; set; }
public string container{ get; set; }
public string sourcesqlserver { get; set; }
}
my controller
public IActionResult Env()
{
var json = System.Path("wwwroot/data/sample.json");
var json = System.IO.ReadAllText(Server.MapPath("wwwroot/data/sample.json"));
return View();
}