Is there a way to limit the number of json items fetched?

Hello all-

I am creating a simple news feed reader as a learn to code. I have created one, but the JSON feed grabs over 2000 objects. I only want the latest 100. Is there a way for me to do this in the code?

Right now, I am testing this using the browser and the app take over 60 seconds to load. I am hoping that if the JSON data is smaller this time lag will not happen.

Thank you,
David

This isn’t much of an Ionic question really, you should be limiting the results on wherever they’re located. If anything, you could provide a parameter in your request to say “I want X objects!”, and the backend then reads that and returns X objects.

So in short: Depends on how your backend is setup.

If you want further assistance, please provide some details about your backend :slight_smile: If you have no control over the backend, I’m hoping the provided a way to limit the amount of objects returned (like with a parameter, as previously explained), so check out their API docs.

Hello mich356c,

Forgive me… I am very new to coding. What do you mean by “backend”?

I created a JSON feed using rssmix.com from a collection of rss feeds that I want to follow. If that is the backend, I don’t think I have control of that.

Thank you,
David

Yes I suppose that would be considered the backend in this scenario. Hmmm, I don’t know this service at all, and a quick Google search didn’t provide any help. Maybe they have some support you could ask?

The limit has to be made on their end, because your request could take a while no matter what you do on your end. If the request itself isn’t too slow, you could just limit the amount of articles you’re displaying at a time in your app? :slight_smile:

Hi Mich356c,

I was able to reduce the feed and it did help reduce the time; however, I am still experiencing a delay of about 10 seconds for the app to load the first time.

Can you offer any other suggestions to reduce the load time of the app?

Thank you,
David

How many are you retrieving and how many of them are you initially displaying in the app?

Now, I am only retrieving 25 different objects. The initial display is only 1 object. I saw on another thread


that if I use ionic build android --prod to generate the apk, the initial load time will be reduced. I will try this to see what happens and report back.

Oh, if you’re not doing that already then it will certainly help.