Ecarrion
Ecarrion

Reputation: 4950

How to Handle Big JSON Response

I'm doing a simple iphone app, but the client sends me an 1.6mb JSON file, The client doesn't want to do any more in the backend, so I need an efficient way to handle this data, the data is going to be used later for filtering and searching inside the app.

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

Update

This JSON in memory is around 4.85mb, do you guys think that is too much for an NSDictionary.

Upvotes: 4

Views: 1461

Answers (1)

Alex Reynolds
Alex Reynolds

Reputation: 96937

Parse the JSON data into a Core Data store, using hashes to determine if a record is new or exists and needs updating. Use of threading for this step will make the app more responsive. You can then efficiently apply predicates (i.e., filter and search) on the data store.

Also, some libraries/frameworks exist to handle the JSON to Core Data mapping such as RestKit. But keep in mind it's also pretty easy to do it yourself if you don't need a generalized solution.

Upvotes: 7

Related Questions