After parsing a value an unexpected character was encountered: 6. Path '[0] After parsing a value an unexpected character was encountered: 6. Path '[0] json json

After parsing a value an unexpected character was encountered: 6. Path '[0]


This looks like an encoding issue. I'm betting your file is saved in UTF-16 encoding, but you are reading it as UTF-8. (UTF-8 is the default encoding for StreamReader.) This would explain why there are all kinds of \0 characters in the middle of your read JSON value, and why Json.Net is having trouble parsing it. Try specifying the encoding when you initialize the StreamReader:

    using (StreamReader sr = new StreamReader(path, Encoding.Unicode, true))    {        ...    }

Alternatively, make sure your JSON file is saved with UTF-8 encoding.


Check that the stream path has its position set appropriately. Perhaps add the line: path.Position = 0; before the call to sr.ReadToEndAsync();