title: Converting JSON to Objective-C object using key value coding
body: <p>I am an Objective-C newbie coming from the Java world, so I am trying to find out how to do something that would be (relatively) straightforward to do in Java.</p>
  
  <p>In an iPhone app I am accessing a rest webservice that returns JSON. I am using the AFNetworking framework, which provides support for using the NSJSONSerialization class added to iOS 5. I would like to know if there is an "automatic" way to turn the JSON object that is returned into one of my "strongly" typed classes (for example, my UserAccount class).</p>
  
  <p>In other words, I'm trying to do something like:</p>
  
  <pre><code>id json = ... call webservice that returns json, which AFNetworking parses ...
  UserAccount myUserAccount = [UserAccount alloc] init];
  //then here I'd like something that iterates through all the properties on the 
  //json object and sets them on the myUserAccount object using key value coding
  </code></pre>
  
  <p>Is there a straightforward way to accomplish this? </p>