How to handle a large JSON response

I am making a simple iphone application, but the client sends me a 1.6 MB JSON file. The client no longer wants to do in the backend, so I need an effective way to process this data, the data collected will be used later for filtering and searching inside the application.

What would you say is the best way to handle this?

Refresh

This JSON in memory is about 4.85 MB, which you think is too much for NSDictionary .

+4
source share
1 answer

Parse the JSON data in the master data store using hashes to determine if the record is new or exists and needs to be updated. Using threads for this step will make the application more responsive. Then you can efficiently apply predicates (i.e. Filter and search) in the data warehouse.

In addition, there are some libraries / frameworks for handling JSON mapping for Core Data, such as RestKit . But keep in mind that this is also pretty easy to do yourself if you don't need a generalized solution.

+7
source

Source: https://habr.com/ru/post/1380445/


All Articles