I'm making a POST request to a server from an IOS app and sending a JSON payload of an email and password value.
My code so far is making a NSDictionary
and serializing it into NSData
:
NSDictionary *dictionary = @{ @"email" : @"khush@gmail.com" , @"password" : @"mypass" };
NSData *payload = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:nil];
I attach the payload as part of the request.HTTPBody
, however the server receives the following data:
{ '{"email":"khush@gmail.com", "password":"mypass"}' : ' ' }
It seems to be taking the whole string as the key and emitting a null as the value.
Any ideas/solutions to this problem? I've had a look at but it doesn't make See this link sense to me.