Get Updates By E-mail 

Article Written By:
Johann Dowa

Open Source: Library For Automatic Serialization/Deserialization To And From JSON Dictionaries

  •  
  •  
  •  
  •  
  •  

Some time ago I mentioned the excellent library allowing you to save any object to a Plist file.

Today I came across a library allowing you to automatically take JSON dictionaries, or property lists and turn them into model objects (or vice versa).

Here’s an example from the Github page demonstrating what makes this library so interesting.

You can take a JSON dictionary like this:

 {
 "userID" : 1234,
 "name" : "Jane Smith",
 "likes" : ["swimming", "movies", "tennis"],
 "invitedBy" : {
 "userID" : 9876,
 "name" : "Bob Willis"
 }
 }

And out comes a model object like this:

 @interface User : NSObject
 @property (assign) int userID;
 @property (copy) NSString *name;
 @property (strong) NSArray *likes;
 @property (strong) User *invitedBy;
 @end

The library is JAGPropertyConverter from James Gill, and you can download the library and find further information on usage on the Github page here.

Definitely a very useful looking library.

[via @romainbriche]


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments