ios - Convert NSmangedObject to JsonModel -
in application using jsonmodel parsing json response server , while storing in core data using nsmanagedobject
, nsmanagedcontext
provided apple itself. whenever fetch want convert nsmanagedobject
jsonmodel. problem have use 2 separate class manage jsonmodel , nsmanagedobject
.
you can link.
or in easy way andrew-madsen's answer
nsmanagedobject *managedobject = ...; nsarray *keys = [nsarray arraywithobjects:@"key1", @"key2", ..., nil]; // these keys properties of managed object want in json nsstring *json = [[managedobject dictionarywithvaluesforkeys:keys] jsonrepresentation];
for more detail try link
Comments
Post a Comment