title: Map webservice data properly into typescript object (mapping Objects with capital letters / pascal case to camel case)
body: <p>I realized a strange thing with my Angular2 typescript project. I have objects coming in from a webservice which have the type "Level" (it has the same properties as the Json coming from the webservice). In runtime comes out that the properties of the Level from the webservice have capital letters (Pascal case) at the beginning and the ones in my typescript project have small ones (visible in the browser's developer debug tool).</p>
  
  <p>I guess I need to map the json properties somewhere somehow instead of doing a cast by writing "as Level[]" everywhere. How to I do it properly?</p>
  
  <p>Update regarding the question that I should post some code:</p>
  
  <p>(Controller)</p>
  
  <pre><code>ngOnInit(): void {
      this.levelsObservable = this.levelsService.getAllLevels();
              this.levelsObservable.subscribe(
                data =&gt; console.log(data)
          );
    }
  </code></pre>
  
  <p>(Service)</p>
  
  <pre><code>observable : Observable&lt;Response&gt;;
  getAllLevels(): Observable&lt;Level[]&gt; {
      this.observable =  this.achievementsService.getAllAchievements(this.allLevelsUrlPart);
      return this.observable
      .map((response: Response) =&gt; {
        const srcData = response.json() as Level[];
        return srcData;})
      .catch(error =&gt; this.handleError(error));}
  
  getAllAchievements(detailPath): Observable&lt;Response&gt; {
  // prepare request url and header
  this.specificUrl = this.webServiceUrl + detailPath;
  this.headers.append('Content-type', 'application/json');
  let options = new RequestOptions({ headers: this.headers });
  this.result = this.http.get(this.specificUrl, options)
  .catch(error =&gt; this.handleError(error));
  return this.result;}
  </code></pre>
  
  <p>Update:
  I polished my code a bit with the help of one answer below (not integrated above because not essential to solve the main problem).
  I tried to use the other answer from below to reach the camel cases but it wasn't working (I have an array and in the array are objects with properties, but an object's properties aren't accessible with iterator methods).</p>
  
  <p>Update: 
  I finally managed it (!) :) I shortened this post a bit and will now post my solution below. It's for sure not the most beautiful, but I'm happy to have one after searching around for hours. Thanks to all people helping me with their great and input here!</p>