Last active
December 19, 2015 17:39
-
-
Save mono0926/5992916 to your computer and use it in GitHub Desktop.
MantleでobjectをJSON化
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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