I'm trying to deserialise a JSON file from local disk into an object. I've got the following, but this only seems to work when downloading it from the web:
var client = new HttpClient();
using (var s = await client.GetStreamAsync(filePath))
using (var sr = new StreamReader(s))
using (var jr = new JsonTextReader(sr))
{
var js = new JsonSerializer();
return js.Deserialize<MyObject>(jr);
}
I'm trying to find a way to do this, without first reading it into a string.