Angular - Unable to connect to json file

Hello everybody,

I’m having issues connecting to a local json file. I tried running the script on my local computer as well as on stackblizs and still getting the same error message. I can seem to isolate the erorr message.

any assistance you can provide would be greatly appreciated.

Error message:

HttpErrorResponse {headers: HttpHeaders, status: 404, statusText: “Not Found”, url: “http://localhost:4200/assets/users.json”, ok: false, …}


       private _url: string = '/assets/users.json';	

  	public members: Login[] = [];
  	constructor( private _http: HttpClient) { }

  	memberLogin(): Observable<Login[]> {    
    	return this._http.get<Login[]>(this._url);


			.subscribe((data: Login[]) => { 
				this.members = data;
				console.log("home: " + JSON.stringify(this.members));

full code can be found at:

Hi @robin01, in your angular.json you have

"assets": [

… but in your project the assets folder is inside src/app. Not sure if stackblitz even supports serving files from assets folders though.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.