Answers for "C# return json data from File"

C#
4

c# read json file into object

// read file into a string and deserialize JSON to a type
Movie movie1 = JsonConvert.DeserializeObject<Movie>(File.ReadAllText(@"c:\movie.json"));

// deserialize JSON directly from a file
using (StreamReader file = File.OpenText(@"c:\movie.json"))
{
    JsonSerializer serializer = new JsonSerializer();
    Movie movie2 = (Movie)serializer.Deserialize(file, typeof(Movie));
}
Posted by: Guest on September-29-2020
0

C# return json data from File

{
   "InsuredType":[
      "Named Insured",
      "Spouse",
      "Rest Of Family"
   ],
   "Cover":[
      "Death & permanent disability",
      "Hospitalisation",
      "Non-Hospitalisation"
   ]
}
Posted by: Guest on May-23-2021

C# Answers by Framework

Browse Popular Code Answers by Language