I am doing a callout to RESTful web service and following the example given here in Integration workbook
My actual requirement is to query for some values and post these values in JSON to webservice.
1) To prepare JSON, I see 2 options: JSONGenerator and Serialize. The difference I noted among them is I can format JSON structure in JSON Generator. Is there any other major difference like size of the JSON etc.
2) While using JsonGenerator, I can write my own field labels in JSON using writeStringField
but If I am going for serialize, I need to declare all field labels with the datatype they are supposed to hold in a separate class. Is it also necessary to declare a separate class to hold these field labels while using JSONGenerator ?
3) Since I am posting values to external webservice, should I use {get;set;}
Thanks
No
to #3