Friday, February 21, 2014

C# : RestSharp Send Javascript Complex Object

Use

var yourobject = new MyObject{.....................};
var json = JsonConvert.SerializeObject(yourobject);
var client = new RestClient(url);
var request = new RestRequest(actionPath, Method.POST);
request .AddParameter("application/json; charset=utf-8", json, ParameterType.RequestBody);
request .RequestFormat = DataFormat.Json;

Source:
https://github.com/restsharp/RestSharp/issues/435

Tuesday, February 4, 2014