c# - Unexpected character encountered while parsing value -
Currently I found some problems Using C with C # Jason.Net is the problem I always have
{"Parsing value encountered an unexpected character: e path", line 0, position 0. "}
So the way I I am using json.net, it is the following: I have a class that should be saved, the class looks like this:
public class stats {summary Vjnik string of {get; Set; } Public string value {get; Set; }} Public class viewerstatarm {public list & lt; Stats & gt; Viewerstats {receive; Set; } Public string version {get; Set; } Public viewer format (bull chuck) {this.viewerstats = new list & lt; stats & gt; (); }}
An object of this class will be filled with and will be saved with:
file. Write all text (tmpfile, JsonConvert.SerializeObject (current), encoding UTF8);
The savings part works fine and the file is present and is full. After that the file will be read back in this category:
Try {ViewerStateformat Current = Jason Convert. Directoryal Object & lt; ViewerStatformat & gt; (TMP File); // otherstuff} hold (exception pre) {// error logging stuff}
Now the exception exists on the current = line:
{"unexpected value The character encountered while parsing: E. Path '', Line 0, Position 0. "}
I do not know why it comes. The JSO file is low - & gt;
You might want to
DeserializeObject to JSON. It looks like
File.WriteAllText (tmpfile, ... that type of
tmpfile is
@ "c: \ Temp \ fooo ". Trying to change something like this fails.
@ >
JsonConvert.DeserializeObject JSON assumes, the file path is not - - which Not explicitly JSON.
Comments
Post a Comment