ios - How do I urlencode this NSString that contains a JSON inside it? -


i have following json string should sent backend

{     id = "mu_200255802";     keywords =     (         talk,         games,         meetup,         time,         meet,         "time game"     ); } 

so before json have java servlet url like

http://....net/servletname? 

how should urlencode json string , url because after trying several options, keep getting bad url error in delegate method. right way it/

i tried encoding using

nsstring *urlstringencoded = [[nsstring stringwithstring:urlstring] stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]; 

and used other encoding formats too.

use create json string

           nserror *error;             nsdata *jsondata = [nsjsonserialization datawithjsonobject:@"your object" options:nsjsonwritingprettyprinted error:&error];             nsstring *jsonstring = [[nsstring alloc] initwithdata:jsondata encoding:nsutf8stringencoding]; 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -