How to Display Data from Json File in Angular?

How to Display Data from Json File in Angular?

In this post we will give you information about How to Display Data from Json File in Angular?. Hear we will give you detail about How to Display Data from Json File in Angular?And how to use it also give you demo for it if it is necessary.

In this tutorial, you will learn how to display data from json file in angular 9/8/7. i would like to share with you how to read json file in angular 9. This post will give you simple example of display json data in html table using angular 8. follow bellow step for how to create a json file in angular.

In this example, we will learn how to create json file in angular. then we will display data from created json file. so basically we will read data from json file in angular app.

Sometime we need to display our data in table format for front end from json file. we will use ngfor directive for display data in table from read json file. we will also use bootstrap for displaying data in angular application. you can also easily display data from json file in angular 6, angular 7, angular 8 and angular 9 application.

Let’s see simple following step to done simple example that will help you to displaying data in angular app.

Create New App

If you are doing example from scratch then You can easily create your angular app using bellow command:

ng new my-app

Create JSON File




"id": 1,

"name": "Hardik",

"email": "",

"gender": "male"



"id": 2,

"name": "Paresh",

"email": "",

"gender": "male"



"id": 3,

"name": "Kiran",

"email": "",

"gender": "female"



"id": 4,

"name": "Mahesh",

"email": "",

"gender": "male"



"id": 5,

"name": "Karan",

"email": "",

"gender": "male"



updated Ts File

In this file we will create students object array using Student interface. so let’s see bellow file code.


import { Component } from '@angular/core';

import studentsData from './students.json';

interface Student {

id: Number;

name: String;

email: String;

gender: String;



selector: 'my-app',

templateUrl: './app.component.html',

styleUrls: [ './app.component.css' ]


export class AppComponent {

name = 'Angular';

students: Student[] = studentsData;


Template Code:

In this step, we will write code for display data of stuidents object array variable using ngfor directive.

I used bootstrap class on this form. if you want to add than then follow this link too: Install Boorstrap 4 to Angular 9.


<div >

<h1>How to Display Data from Json File in Angular 9/8/7? -</h1>

<table >










<tr *ngFor="let student of students">

<td>{{ }}</td>

<td>{{ }}</td>

<td>{{ }}</td>

<td>{{ student.gender }}</td>





Now you can run your application using following command:

Also see:How To Display Data In Angular? | Angular 9/8 Display Data

ng serve

You can see bellow layout for demo. let’s follow bellow step.


I hope it can help you…

Hope this code and post will helped you for implement How to Display Data from Json File in Angular?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

77  +    =  80

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US