# Pass objects from provider to every page after reading a json file

**URL:** <https://forum.ionicframework.com/t/pass-objects-from-provider-to-every-page-after-reading-a-json-file/173756>\
**Category:** ionic-v3\
**Created:** [September 20, 2019, 5:25am UTC](https://forum.ionicframework.com/t/pass-objects-from-provider-to-every-page-after-reading-a-json-file/173756 "2019-09-20T05:25:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![94krishna-rout19](https://avatars.discourse-cdn.com/v4/letter/9/2acd7d/32.png) [@94krishna-rout19](https://forum.ionicframework.com/u/94krishna-rout19)\
**Post date:** [September 20, 2019, 5:25am UTC](https://forum.ionicframework.com/t/pass-objects-from-provider-to-every-page-after-reading-a-json-file/173756/1 "2019-09-20T05:25:27Z")

</div>

HI, I am using file plugin to write into and read data in json file.  
here is my code snippet:

this is provider.ts  
public readfiles() {  
this.file.readAsText(this.file.applicationStorageDirectory,this.fileName).then(text =\> {  
this.ticketList=JSON.parse(text);  
}).  
catch(err =\> {console.log(“file not reading”,err) });  
return this.ticketList ;  
}

this is page.ts  
readfiles(){  
this.file\_rading.readfiles().then((data)=\>{  
console.log(data);

```
})

```

}

I am getting can’t read property “then” is undefined error.what I am doing wrong here pls suggest me.
