I need to send some details to a server from my iphone app.
I have details as separate arrays of ID,name,quantity and strings with name,address,phone & email.
I need to change the NSmutable array data into this JSON format
[
{"id":"139","name":"Samosa","quantity":"332","spice":"hot"},
{"id":"149","name":"rice","quantity":"4","spice":"mild"},
.....
]
My one doubt is [request setHTTPMethod:@"POST"];
Is the above line is enough to set the POST request.
How could I add the above details into the POST request?
Use a JSON serializer. You could use SBJSON. With SBJSON, the code will be like this:
For adding this
jsonParamsto POST: