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.

get core data objects json

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

nsmanagedobject-to-json


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -