Json string sending From IOS to PHP server? -


when trying send json string server result seems this

"["sudheer@gmail.com","venkat@gmail.com"]"

how remove start , end double quotes response.

what mistake doing , why coming of this?

i want output

["sudheer@gmail.com","venkat@gmail.com"]

appdelegate *delegate = (appdelegate *)[[uiapplication sharedapplication] delegate];   nsstring *url = [nsstring stringwithformat:@"http://myurl........."]; nsarray *arrayofstrings = @[@"sudheer@gmail.com", @"venkat@gmail.com"]; nserror *error = nil; nsdata *json; nsstring *jsonstring;  if ([nsjsonserialization isvalidjsonobject:arrayofstrings]) {     // serialize dictionary     json = [nsjsonserialization datawithjsonobject:arrayofstrings options:nsjsonwritingprettyprinted error:&error];      // if no errors, let's view json     if (json != nil && error == nil)     {         jsonstring = [[nsstring alloc] initwithdata:json encoding:nsutf8stringencoding];          nslog(@"json: %@", jsonstring);          //nsstring *cleanedstring=[jsonstring stringbyreplacingoccurrencesofstring:@"/"" withstring:@""];      } }   nsstring *userid = [delegate.objectid stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]; nsstring *projectid = [@"gcyn7uyuvh" stringbyaddingpercentescapesusingencoding:nsutf8stringencoding];  nsmutablestring* requesturl = [[nsmutablestring alloc] initwithstring:url]; nsmutableurlrequest *request = [[nsmutableurlrequest alloc] initwithurl: [nsurl urlwithstring: [nsstring stringwithstring:requesturl]]];  [request sethttpmethod: @"post"]; [request setvalue:@"application/x-www-form-urlencoded" forhttpheaderfield:@"content-type"]; //nsstring *emails = [addsponsoremailstringinmodel componentsjoinedbystring:@","]; [request sethttpbody:[[nsstring stringwithformat:@"userid=%@&projectsponsor=%@&projectid=%@", userid,jsonstring,projectid] datausingencoding:nsutf8stringencoding]];   nsurlresponse *response; nserror *err; nsdata *responsedata = [nsurlconnection sendsynchronousrequest:request returningresponse:&response error:&err]; _addsponsorserverrplystring = [[nsstring alloc] initwithdata:responsedata encoding:nsasciistringencoding]; nslog(@"add sponsor response :%@",_addsponsorserverrplystring); 


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -