title: How to get data of YAML file in the Angular 7 array of objects
body: <p>I know how to get a <strong>JSON</strong> file and to show it in the array in Angular 7 but I am having a problem with the <strong>YAML</strong> file I have searched and I really do not know how to get in the array the <strong>YAML</strong></p>
  
  <p>For the moment I have tried this but it is coming with errors.</p>
  
  <p><code>Service</code></p>
  
  <pre><code>@Injectable({
    providedIn: 'root'
  })
  export class getYamlDataService {
  
    constructor(private http: HttpClient) {
      this.getJson().subscribe(data =&gt; {
        console.log(data);
      })
    }
  
    public getJson(): Observable&lt;any&gt; {
      return this.http.get("./assets/swagger/swagger.yaml");
    }
  }
  </code></pre>
  
  <p><code>Component.ts</code></p>
  
  <pre><code>constructor(private getYamlData: getYamlDataService) {}
  ngOnInit() {
      this.getYamlData.getJson().subscribe(data =&gt; {
        console.log(data);
      });
  </code></pre>
  
  <p><code>Error</code></p>
  
  <p><strong>Http failure during parsing for <a href="http://localhost:4200/assets/swagger/swagger.yaml" rel="nofollow noreferrer">http://localhost:4200/assets/swagger/swagger.yaml</a></strong></p>
  
  <p>But when I open this localhost then it is showing in browser yaml file.</p>