我有这个代码试图打开一个.json文件并阅读它:
[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));
. . .
Run Code Online (Sandbox Code Playgroud)
在最后一行,我得到:
Newtonsoft.Json.JsonReaderException未被用户代码处理HResult = -2146233088 Message =从JsonReader读取JObject时出错.当前的JsonReader项不是对象:
根据我在这里读到的内容,我认为这是实现它的方法.我究竟做错了什么?