0

I'm trying to find the best way the save data obtained from JSON. The website which hosts the data is: "JSON data".

Since I will be using the data in places where I won't have a connection to the internet, I want to save this data on the iPhone itself, with an ability to update when I do have an internet connection.

I'll want to display this data in a table view, and I'll need to be able to filter/search this data. This search will either be on the City, or on the store ID ("no:" in the data). Clicking the row will show a detail view of the store.

I was thinking of storing the data in an SQL table. I'm however unsure of the best way to update the data, and I don't know how to filter the data on two different columns(City/ID)?

Also, if you know a better approach I'd love to hear it!

  • I think you can find your answer here http://stackoverflow.com/questions/5237943/creating-a-json-store-for-iphone – Greg E. H. Jan 10 '13 at 17:40
  • 1
    If you simply want to save the JSON, save it in a file, or in a string/blob in a SQL DB. If you want to be able to dynamically search the JSON you're probably better off storing the "decoded" data in a database. – Hot Licks Jan 10 '13 at 17:40
  • @HotLicks Ok, so I think using a SQL table is the way to go. When I update the data is clearing the table and decode and save again the best thing to do? Or is there an easier way to update the SQL? – Ivo Van de Grift Jan 10 '13 at 17:52
  • It depends on how often you update and how fancy you want to get. Ideally your server would supply a list of updates since the last time you downloaded, but if all you get is that big list, it's probably simplest to just clear the DB and reload it rather than trying to update. – Hot Licks Jan 10 '13 at 19:33

1 Answers1

0

Your data appears to be a table of addresses, with some sort of "detail" records associated with each address. This is a classic master/detail database. Normally you'd have one table with a record for each address, and assign some sort of unique ID to each address. Then have a second table that's keyed by unique ID to contain all of the detail records.

Hot Licks
  • 47,103
  • 17
  • 93
  • 151