Skip to content

Instantly share code, notes, and snippets.

@mono0926
Last active December 19, 2015 17:39
Show Gist options
  • Select an option

  • Save mono0926/5992916 to your computer and use it in GitHub Desktop.

Select an option

Save mono0926/5992916 to your computer and use it in GitHub Desktop.
MantleでobjectをJSON化
MTLJSONAdapter *adapter = [[MTLJSONAdapter alloc] initWithModel:self.book];
NSDictionary*jsonDict = adapter.JSONDictionary;
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:jsonDict options:0 error:nil];
NSString* jsonString = [[NSString alloc] initWithBytes:[jsonData bytes] length:[jsonData length] encoding:NSUTF8StringEncoding];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment