Ionic 4 http native get large json data, app crash


I have an issue with parsing a large json data with the following methods :

 this.http.setHeader('','Content-type', 'application/json');
    this.http.setDataSerializer('utf8');'', JSON.stringify({
    ), {})
    .then((res:any) => {

      let response = JSON.parse(;

      this.http.setHeader('','Accept-Encoding', 'gzip,deflate,sdch');
      this.http.get(''+response.search_id, {},{}).then((res:any) => {
        console.log('list : ',;
      }).catch(error => {
    .catch(error => {
      console.log("Error 0 = ",error)

the 1st ‘POST’ method works, but when I check log , when its trying to run the 2nd get, the app suddenly crash? as the data parsed are around 30MB I checked via postman, and postman crashed too!

anyway, I can parse this efficiently? as there are no limit or pager available

If it’s an option, I would try add the paging on an intermediate server, using something like jq. Any complete solution you try to do simply within Ionic is likely to be a drag on a mobile device.


not sure what is jq for? and meaning of intermediate server?
meaning, I will do the pull from my server to the 3rd api? and the app will pull from my server with paging?

Breaking big JSON into smaller JSONs.

Right, that’s how I would do it, because it does the heavy work in the cloud, where you can throw as many resources at the problem as needed. Your Ionic app then gets to deal with paging, making its life and that of its users easier.

if I go for the intermediate server do I still need the jq??

Well, you’re going to need something on the intermediate server to implement the paging. jq was just a suggestion for that. Personally, I would probably write something in Golang, because it’s great for concurrent middleware processes like that. In fact, I use it for all the backends that talk to my Angular and Ionic apps.

I see, so as long as my intermediate server is pulling it and turning it into a paging data, so angular just http get it and serve it?

Right, at that point you are now in charge of the API that your Ionic app will see, so you can define it in whatever way you think makes the most sense.

1 Like

let me give it a go and update again here :slight_smile: thank you!!!