How to post NSArray using JSON in Objective C
I am developing one app. I want to post NSArrays to webservice that save array data in db.
I am right now using JSON API in my iphone app.
I seek help about how to post nsarrays as i could not find any way to post array data.开发者_开发问答
THanks in advance.
Here i am using sbjon
#import "SBJSON.h"
#import "JSON.h"
SBJSON *jparser = [[SBJSON new] autorelease];
NSString *jsonItems = [jparser stringWithObject:self.urArray];
NSString *userlogin_id=@"AppleVijay";
NSString *venue_id=@"India";
NSString *postString =[NSString stringWithFormat:@"userlogin_id=%@&venue_id=%@&items=%@",userlogin_id,venue_id,jsonItems];
NSURL *urURL=[NSURL URLWithString:@"AppleVijay@facebook.com"];
NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:urURL];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *connection=[[NSURLConnection alloc]
initWithRequest:request delegate:self];
精彩评论