I am currently sending some simple json from an iOS app to server using the following:
NSData *jsonData = [@"{ \"item\": \"hat\" }" dataUsingEncoding:NSUTF8StringEncoding];
I would like to add a bunch of other fields and values.
What would be the appropriate syntax to include more fields?
Something like
NSData *jsonData = [@"{ \"item\": \"hat\",\"id\":2,\"color\":\"blue\" }" dataUsingEncoding:NSUTF8StringEncoding];
Or is there a better way to do this such by sending a dictionary?
NSDictionarywith the values you want. Then convert the dictionary to a JSON string to send to the server?