NSDictionary *customerDictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"blah@blah.com", @"email", @"1", @"facebook", nil];
NSArray *customerArray = [NSArray arrayWithObjects:customerDictionary, nil];
NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:customerArray, @"customers", nil];
NSURLRequest *request = [sharedHTTPClient requestWithMethod:@"POST" path:@"/api/upload" parameters:parameters];
AFJSONRequestOperation *operation =
[AFJSONRequestOperation JSONRequestOperationWithRequest:request
success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {}
failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {}];
[operation start];
在 Node.JS 后端,打印出正文显示:
{ customers: [ '1', 'blah@blah.com' ] }
预期的打印应该是:
{ customers: [{ facebook:'1', email:'blah@blah.com' }] }
我究竟做错了什么?