iphone - how to send JSON in post api using Alomofire SWIFT -


i need send json format in post api using alamofire in swift. way data need send is

{ "data": [{     "id": "1015683997",     "name": "pawel" }, {     "id": "108350039247",     "name": "randeep" }, {     "id": "115607797616",     "name": "mohit" }] } 

and way able generate of is:

["data": { data =     (             {         id = 101583997;         name = "pawel";     },             {         id = 108359247;         name = "randeep";     },             {         id = 11567616;         name = "mohit ";     } ); } ] 

using below mentioned way generate json format.

for in 0..<self.arrfriendslist.count     {          let dictfrndlist:[string: anyobject] = [             "id" : arrfriendslist[i].valueforkey("id")!,"name" : arrfriendslist[i].valueforkey("name")!             ]          arrfrndlist.addobject(dictfrndlist)     } 

then,

let dictfbfrndlist: [string: anyobject] = [          "data":arrfrndlist     ] 

then,

let params: [string: anyobject] = [          "access_token" : accesstoken,         "data":dictfbfriends     ] 

so, please guide me. have spend more day on it. in advance.

i second larme said, should post "arrfrndlist" @ params key "data" not dictfbfrndlist.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -