Rodrigo Fuscaldi
Rodrigo Fuscaldi

Reputation: 182

Save a large JSON to Realm using Swift 3

I have a JSON with more or less 75 keys.

I need to receive this JSON and store offline it using Realm.

I do not want to iterate through the keys, since I've heard that there are ways to save a large JSON using a few lines. How can I do this?

EDIT: My JSON ( I saved on a server away because it's too big) http://myjson.com/i7e6l

Upvotes: 2

Views: 943

Answers (1)

David Pasztor
David Pasztor

Reputation: 54706

There is no easy, one liner to parse the JSON and store it in Realm, since each JSON response is unique and no framework can have explicit knowledge about the structure of your JSON response without you giving some information to this framework about your JSON.

You will need to write some code either to parse the response or to make a mapping between your JSON response's fields and the properties of your Realm object. If you choose the latter solution, you can use Alamofire Object Mapper to do the JSON parsing automatically, but even then you have to write code for the mapping.

Upvotes: 4

Related Questions