title: JsonReaderException: Unexpected character encountered while parsing value ngx-translate
body: <p>I am making a .NET Core application with Angular.</p>
  
  <p>I am having problems with making ngx-translate work for a while now. </p>
  
  <p>I have managed to make it partially work.</p>
  
  <p>With the answer to my previous problems from:</p>
  
  <p><a href="https://github.com/aspnet/Templates/issues/866#issuecomment-326737781" rel="nofollow noreferrer">https://github.com/aspnet/Templates/issues/866#issuecomment-326737781</a></p>
  
  <p>and tutorial from:</p>
  
  <p><a href="https://medium.com/letsboot/translate-angular-4-apps-with-ngx-translate-83302fb6c10d" rel="nofollow noreferrer">https://medium.com/letsboot/translate-angular-4-apps-with-ngx-translate-83302fb6c10d</a></p>
  
  <p>I get Internal Server Error: </p>
  
  <pre><code>JsonReaderException: Unexpected character encountered while parsing value: {. Path 'errorMessage', line 1, position 17. 
  Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)
  Newtonsoft.Json.JsonTextReader.ReadAsString()
  Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, bool hasConverter)
  Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, string id)
  Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, object existingValue)
  Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, object existingValue)
  </code></pre>
  
  <p>when I try to run the application</p>
  
  <p>I did no modifications to the project.</p>
  
  <p>In app.component I have:</p>
  
  <pre><code>import { Component } from '@angular/core';
  import { TranslateService } from "@ngx-translate/core";
  
  @Component({
      selector: 'app',
      templateUrl: './app.component.html',
      styleUrls: ['./app.component.css']
  })
  export class AppComponent {
  
      constructor(private translate: TranslateService) {
          // this language will be used as a fallback when a translation isn't found in the current language
          translate.setDefaultLang('en');
  
          // the lang to use, if the lang isn't available, it will use the current loader to get them
          translate.use('en');
      }
  
      switchLanguage(language: string) {
          this.translate.use(language);
      }
  }
  </code></pre>
  
  <p>If I comment the lines:</p>
  
  <pre><code>translate.setDefaultLang('en');
  ...
  translate.use('en');
  </code></pre>
  
  <p>The application starts. Then if I uncomment the first line, the project automatically rebuilds and it actually goes in home component and replaces:</p>
  
  <pre><code>{{ 'Intro' | translate }}
  </code></pre>
  
  <p>"Intro" with the value in the en.json file...so it kind of works. The problem only appears when I run the project</p>
  
  <p>My en.json file:</p>
  
  <pre><code>{
    "HELLO": "hello",
    "Intro": "Hello I am Arthur, I am 42 years old.",
    "Title": "Translation example"
  }
  </code></pre>
  
  <p>My other json file:</p>
  
  <pre><code>{
    "HELLO": "salut",
    "Intro": "Bonjour je m'appelle Arthur, j'ai 42 ans.",
    "Title": "Exemple de traduction"
  }
  </code></pre>
  
  <p>They are both in assets/i18n in wwwroot.</p>
  
  <p>I do not call Newtonsoft.Json.JsonTextReader so, I guess ngx-translate does it in the background.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>The project can be found here:</p>
  
  <p><a href="https://github.com/dobrinsky/AngularDefault" rel="nofollow noreferrer">https://github.com/dobrinsky/AngularDefault</a></p>