read json data in c# code example
Example 1: how to read json file in C#
public class FormatClass
{
public string JsonName { get; set; }
public string JsonPass { get; set; }
}
public void Read()
{
using (StreamReader Filejosn = new StreamReader("Path.json"))
{
JavaScriptSerializer jss = new JavaScriptSerializer();
var Items = jss.Deserialize<FormatClass>(Filejosn.ReadToEnd());
}
}
Example 2: how get data from json in c#
public class JSONResponse
{
public string status { get; set; }
public List<Article> articles { get; set; }
}
JSONResponse response = JsonConvert.DeserializeObject<JSONResponse>(myJSON);