title: Angular : ERROR SyntaxError: Unexpected token < in JSON at position 0
body: <p>Hi I need help I created an angular service but when I want to view the data from my json file it shows me this error, I tried a lot of unsuccessful solution</p>
  
  <p>app.component.ts</p>
  
  <pre><code>    import {Component, OnInit} from '@angular/core';
      import {Car} from './domain/car';
      import {CarService} from './service/carservice';
  
      @Component({
        selector: 'app-root',
        templateUrl: './app.component.html',
        styleUrls: ['./app.component.css'],
        providers: [CarService]
      })
      export class AppComponent implements OnInit {
        cars1: Car[];
        constructor(private carService: CarService) { }
  
        ngOnInit() {
         this.carService.getCarsSmall().subscribe(cars =&gt; this.cars1 = cars);
        }
      }
  </code></pre>
  
  <p>carservice.ts</p>
  
  <pre><code>@Injectable()
  export class CarService {
  
    private jsonUrl = './cars-smalll.json';
  
    constructor(private http: Http) {}
      getCarsSmall(): Observable&lt;Car[]&gt; {
        return this.http.get(this.jsonUrl)
          .map(this.extractData)
          .catch(this.handleError);
      }
  
      private extractData(res: Response) {
        let body = res.json();
        return body.data || { };
      }
      private handleError (error: Response | any) {
        // In a real world app, you might use a remote logging infrastructure
        let errMsg: string;
        if (error instanceof Response) {
          const body = error.json() || '';
          const err = body.error || JSON.stringify(body);
          errMsg = `${error.status} - ${error.statusText || ''} ${err}`;
        } else {
          errMsg = error.message ? error.message : error.toString();
        }
        console.error(errMsg);
        return Observable.throw(errMsg);
      }
  }
  </code></pre>
  
  <p>cars-smalll.json</p>
  
  <pre><code>[
      {
        "brand": "VW",
        "year": 2012,
        "color": "Orange",
        "vin": "dsad231ff"
      },
      {
        "brand": "Audi",
        "year": 2011,
        "color": "Black",
        "vin": "gwregre345"
      },
      {
        "brand": "Renault",
        "year": 2005,
        "color": "Gray",
        "vin": "h354htr"
      }
  ]
  </code></pre>
  
  <p>thank you in advance.</p>