This sample deserializes JSON retrieved from a file.
public class Movie
{
public string Name { get; set; }
public int Year { get; set; }
}
// read file into a string and deserialize JSON to a type
var movie1 = JsonConvert.DeserializeObject<Movie>(File.ReadAllText(@"c:\movie.json"));
// deserialize JSON directly from a file
using var file = File.OpenText(@"c:\movie.json");
var serializer = new JsonSerializer();
var movie2 = (Movie) serializer.Deserialize(file, typeof(Movie));