I'm posting NSDictionary to server and get NSLog like this :
{"User":"abc@gmail.com","cartItems":[{"productName":"Apple 5s","Qty":1,"price":"1000"}],"userDiscounts":["0001"]}
but the problem is when i am checking this data in server side :
{ '{"User":"abc@gmail.com","cartItems":': { '{"productName":"Apple 4s","Qty":1,"price":"1000"}],"userDiscounts"': { '"0001"]': '' } } }
I'mean, getting '{ and }'
on server side.
What is the problem in both the json dictionary.
This is my method:
// Convert object to data, cartDictionary holding data.
NSData* postData = [NSJSONSerialization dataWithJSONObject:cartDictionary options:kNilOptions error:&error];
NSMutableURLRequest *request= [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:combineProductUrl]];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:postData];
// print json:
NSLog(@"JSON summary: %@", [[NSString alloc] initWithData:postData
encoding:NSUTF8StringEncoding]);