ios - how to access value json object in objective c -
i have json file down code:
{"filecontent":[{"name":"directorffdsgfg","type":"file","ext":"sql","modified":"2013\/04\/11 - 10:00","created":"2013\/04\/11 - 10:00","size":"1577"},{"name":"directory02","type":"file","ext":"sql","modified":"2013\/04\/11 - 12:10","created":"2013\/04\/11 - 12:10","size":"1577"},{"name":"jquery-mousewheel-master","type":"file","ext":"zip","modified":"2013\/04\/11 - 12:10","created":"2013\/04\/11 - 12:10","size":"5213"}],"foldercontent":[{"name":"folder 2","type":"folder","ext":"sql","modified":"2013\/04\/11 - 05:04","created":"2013\/04\/11 - 05:04","size":"1577"},{"name":"folder 1","type":"folder","ext":"zip","modified":"2013\/04\/15 - 09:08","created":"2013\/04\/15 - 09:08","size":"11867"}],"files":9,"folders":2}
i want know access value in object json. (for example want access value of files , folders , filecontent , foldercontent)
i dont know it.
json dictionary, , can use nsjsonserialization convert string dictionary:
nsdata *jsondata = [jsonstring datausingencoding:nsutf8stringencoding]; nsdictionary *json = [nsjsonserialization jsonobjectwithdata:jsondata options:0 error:nil];
then can access properties key, folder content array:
nsarray *foldercontent = [json objectforkey:@"foldercontent"];
Comments
Post a Comment