-1

I am using POST API to send a list of objects like below:

{
 "EmpID":1,
 "EmpDetailID":2,
 "WorkID":3,
 "TestDetailID":4,
 "QuantityRequired":5
 }

I am sending an array of dictionaries, but the web service team has informed me that the dictionary would not work. I have to send it as LIST, but there is no list in Objective C

I tried the following methods:

NSDictionary *dicTest = @{@"EmpID":1,
                      @"EmpDetailID":2,
                      @"WorkID":3,
                      @"TestDetailID":4,
                      @"QuantityRequired":5
                      };
[arrTest addObject: dicTest];

I also tried array of arrays with single objects / multiple objects. But nothing is working. POST call is fine only I wanted to send data in LIST form.

How do I need to send the above data in LIST form?

shim
  • 9,289
  • 12
  • 69
  • 108
user2813740
  • 517
  • 1
  • 7
  • 29
  • 2
    Can you try to improve the question with information about the technologies you're talking about, backend handling and sample of your list? The sample you provided is an object, not a list or array. – mattanja Jan 13 '17 at 12:07
  • in LIST means? can show how? – Piyush Jan 13 '17 at 12:17
  • Eg: { "EmpID":1, "EmpDetailID":2, "WorkID":3, "TestDetailID":4, "QuantityRequired":5 } – user2813740 Jan 13 '17 at 12:24
  • Second post to the same issue http://stackoverflow.com/questions/41481525/nsmutableurlrequest-post-method-with-multiple-objects/41482337?noredirect=1#comment70471033_41482337 – Gulliva Jan 13 '17 at 13:48

1 Answers1

0
NSArray  *array1 = [NSArray arrayWithObjects:@"\"EmpID\":1", @"\"EmpDetailID\":2", @"\"WorkID\":3", nil];

NSString *joinedString = [array1 componentsJoinedByString:@","];
sanjeev sharma
  • 313
  • 2
  • 9