get object from json string in iOS - Xcode -
i have "json" string this.
**
{"success":true,"domains":[{"url":"","name":"test alpha","id":"100"}]}
**
i want check success true and, if true, url.
how can in iphone application - xcode?
nsdata* data = [mystr datausingencoding:nsutf8stringencoding]; nsdictionary* dictionary = [nsjsonserialization jsonobjectwithdata:data options:nsjsonreadingmutablecontainers error:&error]; if(yes == dictionary[@"success"]) { nsstring *urlstring = dictionary[@"domains"][0][@"url"]; }
Comments
Post a Comment