title: Error with NSJSONSerialization - Invalid type in JSON write (Menu)
body: <p>I have an App using core data with 3 entities with very similar attributes. The relationship is such as:</p>
  
  <p>Branch ->> Menu ->> Category ->> FoodItem  </p>
  
  <p>Each entity has an associated class: example</p>
  
  <p><img src="https://i.stack.imgur.com/cJwYB.png" alt="enter image description here"></p>
  
  <p><strong>I am trying to generate JSON representation of the data in sqlite database.</strong></p>
  
  <pre><code>//gets a single menu record which has some categories and each of these have some food items
  id obj = [NSArray arrayWithObject:[[DataStore singleton] getHomeMenu]]; 
  
  NSError *err;
  NSData *jsonData = [NSJSONSerialization dataWithJSONObject:obj options:NSJSONWritingPrettyPrinted error:&amp;err];
  
  NSLog(@"JSON = %@", [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]);
  </code></pre>
  
  <p>But instead of JSON, i get a SIGABRT error.</p>
  
  <pre><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (Menu)'
  </code></pre>
  
  <p>Any ideas how to fix it or how to make the entity classes (Branch, Menu etc) JSON serialization compatible? </p>