iphone - create a json string from NSArray -


in iphone aplication have list of custom objects. need create json string them. how can implement sbjson or iphone sdk?

 nsarray* eventsforupload = [app.dataservice.coredatahelper fetchinstancesof:@"event" where:@"isforupload" is:[nsnumber numberwithbool:yes]];     sbjsonwriter *writer = [[sbjsonwriter alloc] init];       nsstring *actionlinksstr = [writer stringwithobject:eventsforupload]; 

and empty result.

this process simple now, don't have use external libraries, way, (ios 5 & above)

nsarray *myarray; nsdata *jsondata = [nsjsonserialization datawithjsonobject:myarray options:nsjsonwritingprettyprinted error:&error]; nsstring *jsonstring = [[nsstring alloc] initwithdata:jsondata encoding:nsutf8stringencoding]; 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

Error while updating a record in APEX screen -

c++ - In an add-in in Excel, written in C(++), how does one get the name of the function which called into the addin? -