Having a little trouble processing my NSStrings into a valid JSON string.
NSString *version = @"1.1";
NSString *callMethod = @"auth.login";
NSString *paramsConfig = [NSString stringWithFormat:@"{\"email\":\"%@\",\"password\":\"%@\"}", usernameString, passwordString];
int queryId = arc4random()% 10000000;
NSDictionary *userData = [NSDictionary dictionaryWithObjectsAndKeys:version, @"version", callMethod, @"method", [NSNumber numberWithInt:queryId], @"id", paramsConfig, @"params", nil];
NSString* jsonString = [userData JSONRepresentation];
Expected JSON string:
{"version":"1.1","params":"{"email":"s","password":"s"}","id":12345678,"method":"auth.login"}
Actual JSON string:
{"version":"1.1","params":"{\"email\":\"s\",\"password\":\"s\"}","id":12345678,"method":"auth.login"}
Not really sure where I'm going wrong. Any thoughts?
Thanks
Sam