objective c - How to convert a JSON String into an NSArray? -


i facing issue while converting nsstring nsarray.

my string :

["default", "discipleship", "faith", "family", "hope",   "life building", "love", "missions", "relationships"] 

what want elements(default,discipleship etc.) out of string , put them nsarray.

i have tried lot couldn't done, please great , in advance

first convert string nsdata:

nsstring* str = @"[\"default\",\"discipleship\",\"faith\",\"family\",\"hope\",\"life building\",\"love\",\"missions\",\"relationships\"]"; nsdata* data = [str datausingencoding:nsutf8stringencoding]; 

then, use:

nserror *e; nsarray *array = [nsjsonserialization jsonobjectwithdata:data options:nil error:&e]; 

the object array contains elements of json text.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -