I am new to this forum and I am also creating my first plugin with custom API endpoints. I am using a library that contains over 100 classes with models using the Newtonsoft.Json serializer and the JsonProperty attribute. The problem I'm facing is that the class library uses the Newtonsoft.Json serializer, while Jiwa has the default ServiceStack serializer. Our class library uses snake case for JSON, while the class models use Pascal case (the default case in .NET). As a result, when accessing our endpoints, we are getting null values for all properties, except for properties that consist of a single word.
- Code: Select all
public void Configure(Plugin Plugin, ServiceStackHost AppHost, Funq.Container Container, Manager JiwaApplicationManager)
{
JsConfig<object>.SerializeFn = Newtonsoft.Json.JsonConvert.SerializeObject;
JsConfig<object>.DeSerializeFn = Newtonsoft.Json.JsonConvert.DeserializeObject;
}
the above code is not working for us. Need help! Iwant to override the ServiceStack serializer with the Newtonsoft serializer.