title: Creating an object that works with NSJSONSerialization dataWithJSONObject:options:error:
body: <p>At the moment in order to use this function I'm "converting" my object into a dictionary. i.e. the property names become the keys and the property values become the values.</p>
  
  <p>Is there a way to properly do this so that an object will work with this function?</p>
  
  <p>i.e. similar to <code>encodeWithCoder</code> and <code>initWithCoder</code> for use with <code>NSUserDefaults</code>.</p>
  
  <p>I'd like to do ...</p>
  
  <pre><code>NSData *data = [NSJSONSerialization dataWithJSONObject:myObject options:0 error:nil];
  </code></pre>
  
  <p>at the moment I do something like...</p>
  
  <pre><code>NSData *data = [NSJSONSerialization dataWithJSONObject:[myObject dictionaryRepresentation] options:0 error:nil];
  </code></pre>