I am trying to post JSON in camelCase, and have followed the instructions here:
https://github.com/restsharp/RestSharp/wiki/Deserialization#overriding-jsonserializationstrategy
public class CamelCaseSerializerStrategy : PocoJsonSerializerStrategy
{
protected override string MapClrMemberNameToJsonFieldName(string clrPropertyName)
{
return char.ToLower(clrPropertyName[0]) + clrPropertyName.Substring(1);
}
}
Then I am creating a new client with this code:
var client = new RestClient(_baseUrl);
SimpleJson.CurrentJsonSerializerStrategy = new CamelCaseSerializerStrategy();
Still, when making a request, the serializer is not activated. The RestSharp documentation is all over the place and largely incorrect. Looking at the source (RestRequest.AddBody), it doesn't look like the SerializerStrategy is used at all.
I was looking for a way to make this change at the client level, or somewhere that doesn't require modifying each request.
I've seen this blog - and maybe that's the only way. Seems like a huge step back for RestSharp if you can only change serialization strategies at the request level.