# How to read json file in a template

**URL:** <https://forum.ionicframework.com/t/how-to-read-json-file-in-a-template/96868>\
**Category:** ionic-v3\
**Created:** [July 4, 2017, 12:26pm UTC](https://forum.ionicframework.com/t/how-to-read-json-file-in-a-template/96868 "2017-07-04T12:26:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![amine216](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@amine216](https://forum.ionicframework.com/u/amine216)\
**Post date:** [July 4, 2017, 12:26pm UTC](https://forum.ionicframework.com/t/how-to-read-json-file-in-a-template/96868/1 "2017-07-04T12:26:16Z")

</div>

```auto
{
0: "AKERMI##1988",
5: "AKIM DE DUCOR##2005",
6: "AL FATIH##2003",
9: "AMER##1984",
13: "BELAMER##2004",
15: "CHAHATA##1990",
20: "CHARH##1999",
23: "CHEIKH EL ARAB##1990",
24: "DAHESS##1999",
35: "DARIKE##1991",
44: "DARMAN##1998",
50: "DAYJUR##1991",
51: "DJARNI DES FORGES##1995",
55: "DJELMANE##1999",
77: "DJOURDAN##1999",
83: "DORMANE##1984",
103: "FARADJALA##1993",
105: "GITPEN##1994",
110: "HAJJAM##1995",
175: "HAKIM DU BAC##1995",
180: "HALIM##1995",
185: "HAMID##1996",
194: "HAMZA##1995",
204: "HYRAM##1995",
206: "ISSAOUI##1996",
210: "JAMAK##1997",
213: "JEDEL##1997",
231: "JESROY DE CHAILLAC##1997",
232: "KAHLOUN##1998",
233: "KERBELLA##1992",
236: "LATHLETH##1999",
246: "MAJD AL ARAB##2002",
251: "MAKZAN##1991",
258: "MANGANELLO##1990",
259: "MANGUIER DE PIBOUL##1995",
263: "MAYSOUN##2000",
266: "MIGYESS##2000",
269: "MOUSSOUL##2000",
324: "MUNEEF##2001",
334: "NADIM##2001",
336: "NAKKACH##2001",
337: "NEDJAM LOTOIS##1996",
338: "NEMROD DU PAON##2001",
345: "NEZ D'OR##1997",
346: "NIZAM##1998",
348: "ORIENT EXPRESS##1995",
349: "OUAAD##2003",
350: "PHARAON DES CEDRES##2000",
351: "RAAD##2003",
357: "RAEEH##2003",
358: "RAFII##2003",
366: "ROUSHAAN##2003",
371: "SAMIR##1985",
391: "SARKI D'ESPIENS##1992",
392: "SAYAF##2004",
398: "SEMAOU'EL##2004",
400: "SOUR##1985",
404: "SULTAN AL BADR##2004",
405: "TIDJAM LOTOIS##1999",
433: "TOUWAYSSAN##1986",
434: "VENT DREDY##1992",
435: "VIOLET##2001",
436: "ZEIDOUN##1987"
}

```

**test.html**

```auto
  <ion-list>
        <button ion-item *ngFor="let item of etalon" >
                {{ item[0]}}
    </button>

  </ion-list>

```

**test.ts**

```auto
  getDataEtalon() {
   
    return this.data.getEtalon()
            .subscribe(
                  data=> {
                        this.etalon = data;
                         console.log(this.etalon);
                         } );                 
                  }
}

```

**Exception**  
_**Cannot find a differ supporting object ‘[object Object]’ of type ‘object’. NgFor only supports binding to Iterables such as Arrays.**_

---

<div class="post-metadata">

**Author:** ![Meliha](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@Meliha](https://forum.ionicframework.com/u/Meliha)\
**Post date:** [July 4, 2017, 1:26pm UTC](https://forum.ionicframework.com/t/how-to-read-json-file-in-a-template/96868/2 "2017-07-04T13:26:34Z")

</div>

You have a wrong JSON format.

It should be something like;

> {  
> “firstName”: “John”,  
> “lastName”: “Smith”,  
> “isAlive”: true,  
> “age”: 25,  
> “address”: {  
> “streetAddress”: “21 2nd Street”,  
> “city”: “New York”,  
> “state”: “NY”,  
> “postalCode”: “10021-3100”  
> }  
> }

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [July 4, 2017, 7:43pm UTC](https://forum.ionicframework.com/t/how-to-read-json-file-in-a-template/96868/3 "2017-07-04T19:43:45Z")

</div>

The error message seems pretty clear to me. You are feeding `ngFor` an object. It wants an array instead, so somehow you need to turn this object into an array. You’re the only one that knows what that array should look like.
