I've got this code to try to open a .json file and read it:
[Route("{unit}/{begindate}")]
public string Get(string unit, string begindate)
{
string _unit = unit;
string _begindate = String.Format("{0}01", PlatypusWebReportsConstsAndUtils.HyphenizeYYYYMM(begindate));
string appDataFolder = HttpContext.Current.Server.MapPath("~/App_Data/");
// semi-hardcoded file name for now
string jsonFilename = string.Format("PoisonToe_{0}_{1}.json", _unit, _begindate);
string fullPath = Path.Combine(appDataFolder, jsonFilename);
JObject platypusComplianceJson = JObject.Parse(File.ReadAllText(fullPath));
. . .
On the last line, I get:
Newtonsoft.Json.JsonReaderException was unhandled by user code HResult=-2146233088 Message=Error reading JObject from JsonReader. Current JsonReader item is not an object:
Based on what I read here, I thought this would be the way to do it. What am I doing wrong?
See Question&Answers more detail:os