目前,我有一些问题.我在Json.NET中使用C#.问题是我总是得到:
{"分析值时遇到意外字符:e.路径"",第0行,位置0."
So the way I'm using Json.NET is the following. I have a Class which should be saved. The class looks like this:
public class stats
{
public string time { get; set; }
public string value { get; set; }
}
public class ViewerStatsFormat
{
public List<stats> viewerstats { get; set; }
public String version { get; set; }
public ViewerStatsFormat(bool chk)
{
this.viewerstats = new List<stats>();
}
}
One object of this class will be filled and saved with:
File.WriteAllText(tmpfile, JsonConvert.SerializeObject(current), Encoding.UTF8);
保存部分工作正常,文件存在并已填充.之后,将使用以下命令将该文件读回到类中:
try
{
ViewerStatsFormat current = JsonConvert.DeserializeObject<ViewerStatsFormat>(tmpfile);
//otherstuff
}
catch(Exception ex)
{
//error loging stuff
}
Now on the current= line comes the exception:
{"分析值时遇到意外字符:e.路径"",第0行,位置0."
I don't know why this comes. The JSON file is the following -> Click me I am the JSON link
Does anyone have any ideas?