有谁知道Realm(iOS)中是否支持将RLMObject
序列化为JSON以进行导出?
I don't believe there is any support officially, but this article may describe some other third party libraries which may be able to achieve what you are after
It should work like with any other objects:
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:realmObject options:NSJSONWritingPrettyPrinted error:&writeError];
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
But:
An object that may be converted to JSON must have the following properties:
The top level object is an NSArray or NSDictionary.
All objects are instances of NSString, NSNumber, NSArray, NSDictionary, or NSNull.
All dictionary keys are instances of NSString.
Numbers are not NaN or infinity.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.