title: Should I use NSCoder to serialise to JSON?
body: <p>There are a number of questions and answers on SO that ask how do I serialise an object to in objective c.</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/7172001/serialize-and-deserialize-objective-c-objects-into-json">Serialize and Deserialize Objective-C objects into JSON</a></li>
  <li><a href="https://stackoverflow.com/questions/10847865/objective-c-serialize-list-of-complex-objects">Objective C serialize list of complex objects</a></li>
  <li><a href="https://stackoverflow.com/questions/19459750/serialize-custom-object-to-json-which-contains-nsmutablearray">Serialize custom object to JSON which contains NSMutableArray</a></li>
  <li><a href="https://stackoverflow.com/questions/8921698/how-to-serialize-a-class-in-ios-sdk-objective-c">How to serialize a class in IOS sdk (Objective-c)?</a></li>
  </ul>
  
  <p>The following 3 methods are all mentioned in the above links.</p>
  
  <p>1) Use <code>NSJSONSerialization</code> to serialise the object to JSON. Seems good but this requires the object in question to be either an array or dictionary at its top level. Common solution is to declare custom <code>toDictionary</code> or <code>serialise</code> method that loops over the properties and sets the relevant key and values.</p>
  
  <p>2) Conform to the <code>NSCoder</code> protocol, a little like the approach above but there seems to be some confusion around whether or not this can serialise to JSON or just to <code>NSData</code>.</p>
  
  <p>3) Third party library.</p>
  
  <p>I'm getting slightly confused as to what approach to take. I want to serialise to JSON, there are contradictory answers some stating you can use NSCoder some saying not. I know that a third party app will work however I'd rather implement something simple like options 1 or 2.</p>
  
  <p>Thoughts?</p>