'RestSharp AddJsonBody serialization camel case
I'm using RestSharp v107.1.1 in a .net 5.0 core web app and when i add an object to my RestRequest with AddJsonBody it's serializing the property names in camel casing.
How do i make RestSharp not modify the property names when serializing!?
request.AddJsonBody(new { IHateCamelCase = "why you do this!" });
results in
CONTENT <root type="object"> <iHateCamelCase type="string">why you do this!</iHateCamelCase> </root>
when it should look like this
CONTENT <root type="object"> <IHateCamelCase type="string">why you do this!</iHateCamelCase> </root>
An example would be great!
Solution 1:[1]
You need to configure the serializer as you would do with anything else.
var options = new JsonSerializerOptions(JsonSerializerDefaults.General);
client.UseSystemTextJson(options);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alexey Zimarev |
