title: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: S. Path '', line 0, position 0. Only on certain build
body: <p>I'm working on porting a discord.net bot I made to a raspberry Pi, and I'm getting an error when I build and run it on the pi that does not show up when I build and run it anywhere else.</p>
  <pre><code>Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: S. Path '', line 0, position 0.
  </code></pre>
  <p>This is the error I get when running the project (token data for the bot is stored in json files) they are read from completely fine when I run the project out of visual studio on my PC, but when I build the project on the PI and run it I get this error.</p>
  <p>I found a stackoverflow page on this error and none of the solutions seem to be solving my issue.</p>
  <ul>
  <li><p>I ran my json data through a validation website and it checks out</p>
  </li>
  <li><p>I saw one post talking about it maybe being a UTF encoding issue, so I tried a fix where I'm passing in UTF-8 encoded text, and same error. Then I tried with UTF-32 and that makes the error appear on my PC and on the PI!</p>
  </li>
  <li><p>I have a feeling that it has something to do with its encoding, but I really am stuck here and I cannot find anymore forums discussing this issue. Any pointers or ideas are appreciated!</p>
  </li>
  </ul>
  <p>This is the code that is throwing the error, <code>JsonFromPath</code> returns raw json data from a file, <code>DataFromJson</code> is what deserializes it, and this is where the error is being thrown.</p>
  <pre><code>public string JsonFromPath(string path)
  {
      try
      {
          string result;
          using (var reader = new StreamReader(path))
          {
              result = reader.ReadToEnd();
          }
  
          return result;
      }
      catch(Exception ex) { return ex.ToString(); }
  }
  
  public T DataFromJson(string json)
  {
      return JsonConvert.DeserializeObject&lt;T&gt;(json);
  }
  </code></pre>